Skip to content

Commit d6d9410

Browse files
committed
rolling all the migrations into one
1 parent 15fc0f8 commit d6d9410

File tree

3 files changed

+5
-70
lines changed

3 files changed

+5
-70
lines changed

ux.symfony.com/migrations/Version20230414182403.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

ux.symfony.com/migrations/Version20230414182453.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

ux.symfony.com/migrations/Version20230322181630.php renamed to ux.symfony.com/migrations/Version20230418200005.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Auto-generated Migration: Please modify to your needs!
1212
*/
13-
final class Version20230322181630 extends AbstractMigration
13+
final class Version20230418200005 extends AbstractMigration
1414
{
1515
public function getDescription(): string
1616
{
@@ -20,11 +20,13 @@ public function getDescription(): string
2020
public function up(Schema $schema): void
2121
{
2222
// 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)');
2324
$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)');
2425
$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)');
2526
$this->addSql('CREATE INDEX IDX_1DDE477B2989F1FD ON invoice_item (invoice_id)');
2627
$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)');
2830
$this->addSql('CREATE TEMPORARY TABLE __temp__food AS SELECT id, name, votes FROM food');
2931
$this->addSql('DROP TABLE food');
3032
$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
4143
public function down(Schema $schema): void
4244
{
4345
// this down() migration is auto-generated, please modify it to your needs
46+
$this->addSql('DROP TABLE category');
4447
$this->addSql('DROP TABLE invoice');
4548
$this->addSql('DROP TABLE invoice_item');
4649
$this->addSql('DROP TABLE product');

0 commit comments

Comments
 (0)