From 14c5221ac130925f2278a89139fbb95d36daeeb4 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sat, 27 Apr 2024 22:41:33 -0400 Subject: [PATCH] New migrations --- migrations/Version20240424220326.php | 45 +++++++++++++++++++++++++ migrations/Version20240425003903.php | 49 ++++++++++++++++++++++++++++ migrations/Version20240425210626.php | 43 ++++++++++++++++++++++++ migrations/Version20240425231139.php | 45 +++++++++++++++++++++++++ 4 files changed, 182 insertions(+) create mode 100644 migrations/Version20240424220326.php create mode 100644 migrations/Version20240425003903.php create mode 100644 migrations/Version20240425210626.php create mode 100644 migrations/Version20240425231139.php diff --git a/migrations/Version20240424220326.php b/migrations/Version20240424220326.php new file mode 100644 index 0000000..65f4772 --- /dev/null +++ b/migrations/Version20240424220326.php @@ -0,0 +1,45 @@ +addSql('CREATE TABLE bible (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, book VARCHAR(255) NOT NULL, chapter INTEGER NOT NULL, verse INTEGER NOT NULL, content CLOB NOT NULL, book_index INTEGER NOT NULL)'); + $this->addSql('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date) SELECT id, speaker_id, series_id, title, text, date FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_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('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date) SELECT id, speaker_id, series_id, title, text, date FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_id)'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + } +} diff --git a/migrations/Version20240425003903.php b/migrations/Version20240425003903.php new file mode 100644 index 0000000..f4b10be --- /dev/null +++ b/migrations/Version20240425003903.php @@ -0,0 +1,49 @@ +addSql('ALTER TABLE bible ADD COLUMN label VARCHAR(255) DEFAULT NULL'); + $this->addSql('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date) SELECT id, speaker_id, series_id, title, text, date FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_id)'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TEMPORARY TABLE __temp__bible AS SELECT id, book, chapter, verse, content, book_index FROM bible'); + $this->addSql('DROP TABLE bible'); + $this->addSql('CREATE TABLE bible (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, book VARCHAR(255) NOT NULL, chapter INTEGER NOT NULL, verse INTEGER NOT NULL, content CLOB NOT NULL, book_index INTEGER NOT NULL)'); + $this->addSql('INSERT INTO bible (id, book, chapter, verse, content, book_index) SELECT id, book, chapter, verse, content, book_index FROM __temp__bible'); + $this->addSql('DROP TABLE __temp__bible'); + $this->addSql('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date) SELECT id, speaker_id, series_id, title, text, date FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_id)'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + } +} diff --git a/migrations/Version20240425210626.php b/migrations/Version20240425210626.php new file mode 100644 index 0000000..c291283 --- /dev/null +++ b/migrations/Version20240425210626.php @@ -0,0 +1,43 @@ +addSql('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, passage VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date) SELECT id, speaker_id, series_id, title, text, date FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date) SELECT id, speaker_id, series_id, title, text, date FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_id)'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + } +} diff --git a/migrations/Version20240425231139.php b/migrations/Version20240425231139.php new file mode 100644 index 0000000..cd81a87 --- /dev/null +++ b/migrations/Version20240425231139.php @@ -0,0 +1,45 @@ +addSql('CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, is_verified BOOLEAN NOT NULL)'); + $this->addSql('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date, passage FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, passage VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date, passage) SELECT id, speaker_id, series_id, title, text, date, passage FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_id)'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + } + + 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('CREATE TEMPORARY TABLE __temp__notes AS SELECT id, speaker_id, series_id, title, text, date, passage FROM notes'); + $this->addSql('DROP TABLE notes'); + $this->addSql('CREATE TABLE notes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, speaker_id INTEGER NOT NULL, series_id INTEGER DEFAULT NULL, title VARCHAR(255) NOT NULL, text CLOB NOT NULL, date DATE NOT NULL, passage VARCHAR(255) DEFAULT NULL, CONSTRAINT FK_11BA68CD04A0F27 FOREIGN KEY (speaker_id) REFERENCES speaker (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11BA68C5278319C FOREIGN KEY (series_id) REFERENCES series (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO notes (id, speaker_id, series_id, title, text, date, passage) SELECT id, speaker_id, series_id, title, text, date, passage FROM __temp__notes'); + $this->addSql('DROP TABLE __temp__notes'); + $this->addSql('CREATE INDEX IDX_11BA68CD04A0F27 ON notes (speaker_id)'); + $this->addSql('CREATE INDEX IDX_11BA68C5278319C ON notes (series_id)'); + } +}