You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,11 +20,13 @@ public function getDescription(): string
20
20
publicfunctionup(Schema$schema): void
21
21
{
22
22
// this up() migration is auto-generated, please modify it to your needs
23
+
$this->addSql('CREATE TABLE category (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL)');
23
24
$this->addSql('CREATE TABLE invoice (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, customer_name VARCHAR(255) NOT NULL, customer_email VARCHAR(255) NOT NULL, tax_rate INTEGER NOT NULL)');
24
25
$this->addSql('CREATE TABLE invoice_item (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, invoice_id INTEGER NOT NULL, product_id INTEGER NOT NULL, quantity INTEGER NOT NULL, CONSTRAINT FK_1DDE477B2989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_1DDE477B4584665A FOREIGN KEY (product_id) REFERENCES product (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
25
26
$this->addSql('CREATE INDEX IDX_1DDE477B2989F1FD ON invoice_item (invoice_id)');
26
27
$this->addSql('CREATE INDEX IDX_1DDE477B4584665A ON invoice_item (product_id)');
27
-
$this->addSql('CREATE TABLE product (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL, price INTEGER NOT NULL)');
28
+
$this->addSql('CREATE TABLE product (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, category_id INTEGER NOT NULL, name VARCHAR(255) NOT NULL, price INTEGER NOT NULL, CONSTRAINT FK_D34A04AD12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
29
+
$this->addSql('CREATE INDEX IDX_D34A04AD12469DE2 ON product (category_id)');
28
30
$this->addSql('CREATE TEMPORARY TABLE __temp__food AS SELECT id, name, votes FROM food');
29
31
$this->addSql('DROP TABLE food');
30
32
$this->addSql('CREATE TABLE food (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL, votes INTEGER NOT NULL)');
@@ -41,6 +43,7 @@ public function up(Schema $schema): void
41
43
publicfunctiondown(Schema$schema): void
42
44
{
43
45
// this down() migration is auto-generated, please modify it to your needs
0 commit comments