diff --git a/migrations/Version20230331091353.php b/migrations/Version20230331091353.php index f5ae864..2cf45d2 100644 --- a/migrations/Version20230331091353.php +++ b/migrations/Version20230331091353.php @@ -20,7 +20,7 @@ final class Version20230331091353 extends AbstractMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs -// $this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649F85E0677 (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649F85E0677 (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); } public function down(Schema $schema): void diff --git a/migrations/Version20230403161503.php b/migrations/Version20230403161503.php index 8397657..7f04fb1 100644 --- a/migrations/Version20230403161503.php +++ b/migrations/Version20230403161503.php @@ -20,7 +20,7 @@ final class Version20230403161503 extends AbstractMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs -// $this->addSql('ALTER TABLE user ADD name VARCHAR(255) NOT NULL, ADD email VARCHAR(255) NOT NULL'); + $this->addSql('ALTER TABLE user ADD name VARCHAR(255) NOT NULL, ADD email VARCHAR(255) NOT NULL'); } public function down(Schema $schema): void diff --git a/migrations/Version20230403214405.php b/migrations/Version20230403214405.php index a9bf7e0..d5466f4 100644 --- a/migrations/Version20230403214405.php +++ b/migrations/Version20230403214405.php @@ -20,8 +20,8 @@ final class Version20230403214405 extends AbstractMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs -// $this->addSql('CREATE TABLE snip (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_FEBD9796B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); -// $this->addSql('ALTER TABLE snip ADD CONSTRAINT FK_FEBD9796B03A8386 FOREIGN KEY (created_by_id) REFERENCES `user` (id)'); + $this->addSql('CREATE TABLE snip (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_FEBD9796B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE snip ADD CONSTRAINT FK_FEBD9796B03A8386 FOREIGN KEY (created_by_id) REFERENCES `user` (id)'); } public function down(Schema $schema): void diff --git a/migrations/Version20230404215108.php b/migrations/Version20230404215108.php index 711a159..3e1aae2 100644 --- a/migrations/Version20230404215108.php +++ b/migrations/Version20230404215108.php @@ -20,7 +20,7 @@ final class Version20230404215108 extends AbstractMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs -// $this->addSql('ALTER TABLE snip ADD public TINYINT(1) NOT NULL'); + $this->addSql('ALTER TABLE snip ADD public TINYINT(1) NOT NULL'); } public function down(Schema $schema): void diff --git a/migrations/Version20231217002445.php b/migrations/Version20231217002445.php index 7d029d7..ef4153b 100644 --- a/migrations/Version20231217002445.php +++ b/migrations/Version20231217002445.php @@ -20,10 +20,10 @@ final class Version20231217002445 extends AbstractMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs -// $this->addSql('CREATE TABLE snip_content (id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', snip_id INT NOT NULL, parent_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:ulid)\', text LONGTEXT DEFAULT NULL, INDEX IDX_185DCA87140FD260 (snip_id), INDEX IDX_185DCA87727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); -// $this->addSql('ALTER TABLE snip_content ADD CONSTRAINT FK_185DCA87140FD260 FOREIGN KEY (snip_id) REFERENCES snip (id)'); -// $this->addSql('ALTER TABLE snip_content ADD CONSTRAINT FK_185DCA87727ACA70 FOREIGN KEY (parent_id) REFERENCES snip_content (id)'); -// $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\''); + $this->addSql('CREATE TABLE snip_content (id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', snip_id INT NOT NULL, parent_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:ulid)\', text LONGTEXT DEFAULT NULL, INDEX IDX_185DCA87140FD260 (snip_id), INDEX IDX_185DCA87727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE snip_content ADD CONSTRAINT FK_185DCA87140FD260 FOREIGN KEY (snip_id) REFERENCES snip (id)'); + $this->addSql('ALTER TABLE snip_content ADD CONSTRAINT FK_185DCA87727ACA70 FOREIGN KEY (parent_id) REFERENCES snip_content (id)'); + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\''); } public function down(Schema $schema): void diff --git a/migrations/Version20231220204107.php b/migrations/Version20231220204107.php index b855ee3..cb91e17 100644 --- a/migrations/Version20231220204107.php +++ b/migrations/Version20231220204107.php @@ -20,9 +20,9 @@ final class Version20231220204107 extends AbstractMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs -// $this->addSql('ALTER TABLE snip ADD active_version_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:ulid)\', DROP active_commit'); -// $this->addSql('ALTER TABLE snip ADD CONSTRAINT FK_FEBD97966A1E45F3 FOREIGN KEY (active_version_id) REFERENCES snip_content (id)'); -// $this->addSql('CREATE INDEX IDX_FEBD97966A1E45F3 ON snip (active_version_id)'); + $this->addSql('ALTER TABLE snip ADD active_version_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:ulid)\', DROP active_commit'); + $this->addSql('ALTER TABLE snip ADD CONSTRAINT FK_FEBD97966A1E45F3 FOREIGN KEY (active_version_id) REFERENCES snip_content (id)'); + $this->addSql('CREATE INDEX IDX_FEBD97966A1E45F3 ON snip (active_version_id)'); } public function down(Schema $schema): void