summaryrefslogtreecommitdiff
path: root/SQL/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'SQL/mysql')
-rw-r--r--SQL/mysql/2013011000.sql2
-rw-r--r--SQL/mysql/2013042700.sql1
-rw-r--r--SQL/mysql/2013052500.sql7
-rw-r--r--SQL/mysql/2013061000.sql24
4 files changed, 33 insertions, 1 deletions
diff --git a/SQL/mysql/2013011000.sql b/SQL/mysql/2013011000.sql
index f0b5e6a03..d1ea001db 100644
--- a/SQL/mysql/2013011000.sql
+++ b/SQL/mysql/2013011000.sql
@@ -1,6 +1,6 @@
-- Upgrade from 0.9-beta
-CREATE TABLE `system` (
+CREATE TABLE IF NOT EXISTS `system` (
`name` varchar(64) NOT NULL,
`value` mediumtext,
PRIMARY KEY(`name`)
diff --git a/SQL/mysql/2013042700.sql b/SQL/mysql/2013042700.sql
new file mode 100644
index 000000000..fe6741a02
--- /dev/null
+++ b/SQL/mysql/2013042700.sql
@@ -0,0 +1 @@
+-- empty \ No newline at end of file
diff --git a/SQL/mysql/2013052500.sql b/SQL/mysql/2013052500.sql
new file mode 100644
index 000000000..b5f72b8ab
--- /dev/null
+++ b/SQL/mysql/2013052500.sql
@@ -0,0 +1,7 @@
+CREATE TABLE `cache_shared` (
+ `cache_key` varchar(255) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
+ `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
+ `data` longtext NOT NULL,
+ INDEX `created_index` (`created`),
+ INDEX `cache_key_index` (`cache_key`)
+) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
diff --git a/SQL/mysql/2013061000.sql b/SQL/mysql/2013061000.sql
new file mode 100644
index 000000000..54041b340
--- /dev/null
+++ b/SQL/mysql/2013061000.sql
@@ -0,0 +1,24 @@
+ALTER TABLE `cache` ADD `expires` datetime DEFAULT NULL;
+ALTER TABLE `cache_shared` ADD `expires` datetime DEFAULT NULL;
+ALTER TABLE `cache_index` ADD `expires` datetime DEFAULT NULL;
+ALTER TABLE `cache_thread` ADD `expires` datetime DEFAULT NULL;
+ALTER TABLE `cache_messages` ADD `expires` datetime DEFAULT NULL;
+
+-- initialize expires column with created/changed date + 7days
+UPDATE `cache` SET `expires` = `created` + interval 604800 second;
+UPDATE `cache_shared` SET `expires` = `created` + interval 604800 second;
+UPDATE `cache_index` SET `expires` = `changed` + interval 604800 second;
+UPDATE `cache_thread` SET `expires` = `changed` + interval 604800 second;
+UPDATE `cache_messages` SET `expires` = `changed` + interval 604800 second;
+
+ALTER TABLE `cache` DROP INDEX `created_index`;
+ALTER TABLE `cache_shared` DROP INDEX `created_index`;
+ALTER TABLE `cache_index` DROP `changed`;
+ALTER TABLE `cache_thread` DROP `changed`;
+ALTER TABLE `cache_messages` DROP `changed`;
+
+ALTER TABLE `cache` ADD INDEX `expires_index` (`expires`);
+ALTER TABLE `cache_shared` ADD INDEX `expires_index` (`expires`);
+ALTER TABLE `cache_index` ADD INDEX `expires_index` (`expires`);
+ALTER TABLE `cache_thread` ADD INDEX `expires_index` (`expires`);
+ALTER TABLE `cache_messages` ADD INDEX `expires_index` (`expires`);