From fefa367242de85f46250fb8da46dbae3f5545836 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 17 Jun 2021 00:18:34 +0200 Subject: Add migrations directory This commit adds the directory core/db/migrations/ which contains all migrations that were applied to the database since the first release. --- core/db/migrations/1.sql | 3 +++ core/db/migrations/2.sql | 3 +++ core/db/migrations/3.sql | 6 ++++++ core/db/migrations/4.sql | 3 +++ core/db/migrations/5.sql | 3 +++ 5 files changed, 18 insertions(+) create mode 100644 core/db/migrations/1.sql create mode 100644 core/db/migrations/2.sql create mode 100644 core/db/migrations/3.sql create mode 100644 core/db/migrations/4.sql create mode 100644 core/db/migrations/5.sql (limited to 'core/db/migrations') diff --git a/core/db/migrations/1.sql b/core/db/migrations/1.sql new file mode 100644 index 0000000..a875d13 --- /dev/null +++ b/core/db/migrations/1.sql @@ -0,0 +1,3 @@ +ALTER TABLE `page` ADD `argv` VARCHAR(100) NULL DEFAULT NULL AFTER `body`; +ALTER TABLE `post` ADD `argv` VARCHAR(100) NULL DEFAULT NULL AFTER `body`; +ALTER TABLE `user` ADD `argv` VARCHAR(100) NULL DEFAULT NULL AFTER `body`; diff --git a/core/db/migrations/2.sql b/core/db/migrations/2.sql new file mode 100644 index 0000000..525b768 --- /dev/null +++ b/core/db/migrations/2.sql @@ -0,0 +1,3 @@ +ALTER TABLE `page` ADD UNIQUE KEY `time_insert` (`time_insert`); +ALTER TABLE `post` ADD UNIQUE KEY `time_insert` (`time_insert`); +ALTER TABLE `user` ADD UNIQUE KEY `time_insert` (`time_insert`); diff --git a/core/db/migrations/3.sql b/core/db/migrations/3.sql new file mode 100644 index 0000000..ae46ed0 --- /dev/null +++ b/core/db/migrations/3.sql @@ -0,0 +1,6 @@ +ALTER TABLE `post` ENGINE=InnoDB; +ALTER TABLE `post` DROP INDEX `body`; +ALTER TABLE `page` ADD FULLTEXT KEY `search` (`name`, `body`); +ALTER TABLE `post` ADD FULLTEXT KEY `search` (`name`, `body`); +ALTER TABLE `post` ADD CONSTRAINT `post_user` FOREIGN KEY (`user`) + REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/core/db/migrations/4.sql b/core/db/migrations/4.sql new file mode 100644 index 0000000..4a26c48 --- /dev/null +++ b/core/db/migrations/4.sql @@ -0,0 +1,3 @@ +ALTER TABLE `page` MODIFY `argv` VARCHAR(250); +ALTER TABLE `post` MODIFY `argv` VARCHAR(250); +ALTER TABLE `user` MODIFY `argv` VARCHAR(250); diff --git a/core/db/migrations/5.sql b/core/db/migrations/5.sql new file mode 100644 index 0000000..a3c8e5a --- /dev/null +++ b/core/db/migrations/5.sql @@ -0,0 +1,3 @@ +CREATE TABLE `migration` (`schema_version` smallint(4) NOT NULL) + ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +INSERT INTO `migration` (`schema_version`) VALUES (5); -- cgit v1.2.3