diff --git a/migrations/.gitignore b/migrations/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/migrations/Version20240505234804.php b/migrations/Version20240505234804.php new file mode 100644 index 0000000..32152f9 --- /dev/null +++ b/migrations/Version20240505234804.php @@ -0,0 +1,42 @@ +addSql('CREATE TABLE user (id BLOB NOT NULL --(DC2Type:uuid) + , email VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json) + , password VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON user (email)'); + $this->addSql('CREATE TABLE messenger_messages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, headers CLOB NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable) + , available_at DATETIME NOT NULL --(DC2Type:datetime_immutable) + , delivered_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable) + )'); + $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)'); + $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)'); + $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE user'); + $this->addSql('DROP TABLE messenger_messages'); + } +} diff --git a/migrations/Version20240513011501.php b/migrations/Version20240513011501.php new file mode 100644 index 0000000..dccc097 --- /dev/null +++ b/migrations/Version20240513011501.php @@ -0,0 +1,62 @@ +addSql('CREATE TABLE bible (id BLOB NOT NULL --(DC2Type:uuid) + , book VARCHAR(255) NOT NULL, chapter INTEGER NOT NULL, verse INTEGER NOT NULL, content CLOB DEFAULT NULL, book_index INTEGER NOT NULL, label VARCHAR(20) DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE note (id BLOB NOT NULL --(DC2Type:uuid) + , speaker_id BLOB DEFAULT NULL --(DC2Type:uuid) + , series_id BLOB DEFAULT NULL --(DC2Type:uuid) + , user_id BLOB DEFAULT NULL --(DC2Type:uuid) + , title VARCHAR(255) NOT NULL, date DATE NOT NULL, passage VARCHAR(255) NOT NULL, refs CLOB DEFAULT NULL --(DC2Type:json) + , text CLOB DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_CFBDFA14D04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_CFBDFA145278319C FOREIGN KEY (series_id) REFERENCES series (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_CFBDFA14A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('CREATE INDEX IDX_CFBDFA14D04A0F27 ON note (speaker_id)'); + $this->addSql('CREATE INDEX IDX_CFBDFA145278319C ON note (series_id)'); + $this->addSql('CREATE INDEX IDX_CFBDFA14A76ED395 ON note (user_id)'); + $this->addSql('CREATE TABLE reference (id BLOB NOT NULL --(DC2Type:uuid) + , type VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, ndx INTEGER NOT NULL, content CLOB DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE series (id BLOB NOT NULL --(DC2Type:uuid) + , user_id BLOB DEFAULT NULL --(DC2Type:uuid) + , template_id BLOB DEFAULT NULL --(DC2Type:uuid) + , name VARCHAR(255) NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_3A10012DA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_3A10012D5DA0FB8 FOREIGN KEY (template_id) REFERENCES template (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('CREATE INDEX IDX_3A10012DA76ED395 ON series (user_id)'); + $this->addSql('CREATE INDEX IDX_3A10012D5DA0FB8 ON series (template_id)'); + $this->addSql('CREATE TABLE speaker (id BLOB NOT NULL --(DC2Type:uuid) + , user_id BLOB DEFAULT NULL --(DC2Type:uuid) + , name VARCHAR(255) NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_7B85DB61A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('CREATE INDEX IDX_7B85DB61A76ED395 ON speaker (user_id)'); + $this->addSql('CREATE TABLE template (id BLOB NOT NULL --(DC2Type:uuid) + , user_id BLOB DEFAULT NULL --(DC2Type:uuid) + , name VARCHAR(255) NOT NULL, content CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_97601F83A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('CREATE INDEX IDX_97601F83A76ED395 ON template (user_id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE bible'); + $this->addSql('DROP TABLE note'); + $this->addSql('DROP TABLE reference'); + $this->addSql('DROP TABLE series'); + $this->addSql('DROP TABLE speaker'); + $this->addSql('DROP TABLE template'); + } +} diff --git a/migrations/Version20240513161129.php b/migrations/Version20240513161129.php new file mode 100644 index 0000000..8e1df1d --- /dev/null +++ b/migrations/Version20240513161129.php @@ -0,0 +1,41 @@ +addSql('CREATE TEMPORARY TABLE __temp__reference AS SELECT id, type, name, label, ndx, content FROM reference'); + $this->addSql('DROP TABLE reference'); + $this->addSql('CREATE TABLE reference (id BLOB NOT NULL --(DC2Type:uuid) + , type VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, ndx INTEGER DEFAULT NULL, content CLOB DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('INSERT INTO reference (id, type, name, label, ndx, content) SELECT id, type, name, label, ndx, content FROM __temp__reference'); + $this->addSql('DROP TABLE __temp__reference'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TEMPORARY TABLE __temp__reference AS SELECT id, type, name, label, ndx, content FROM reference'); + $this->addSql('DROP TABLE reference'); + $this->addSql('CREATE TABLE reference (id BLOB NOT NULL --(DC2Type:uuid) + , type VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, ndx INTEGER NOT NULL, content CLOB DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('INSERT INTO reference (id, type, name, label, ndx, content) SELECT id, type, name, label, ndx, content FROM __temp__reference'); + $this->addSql('DROP TABLE __temp__reference'); + } +}