diff options
author | Thomas Lange <code@nerdmind.de> | 2021-06-17 00:18:34 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-06-17 00:18:34 +0200 |
commit | fefa367242de85f46250fb8da46dbae3f5545836 (patch) | |
tree | 135c54d4cd07abababddf30d891bd8dce0e4b1ea | |
parent | 85d6e75d4c77d13f6f5c0c7bc75f6ed48ee6df6c (diff) | |
download | blog-fefa367242de85f46250fb8da46dbae3f5545836.tar.gz blog-fefa367242de85f46250fb8da46dbae3f5545836.tar.xz blog-fefa367242de85f46250fb8da46dbae3f5545836.zip |
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.
-rw-r--r-- | core/db/migrations/1.sql | 3 | ||||
-rw-r--r-- | core/db/migrations/2.sql | 3 | ||||
-rw-r--r-- | core/db/migrations/3.sql | 6 | ||||
-rw-r--r-- | core/db/migrations/4.sql | 3 | ||||
-rw-r--r-- | core/db/migrations/5.sql | 3 |
5 files changed, 18 insertions, 0 deletions
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); |