summaryrefslogtreecommitdiffstats
path: root/application/migrations
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-08-29 17:41:33 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-08-29 17:43:19 +0200
commitd7621c2c01074bdcabd6a8c1a8e95c95d00319bf (patch)
treebfcff5599f26939f185bd0208538b56f39a3dc57 /application/migrations
parent08c68f84f4a8519912e31f85823694186de804cf (diff)
add multipaste support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/migrations')
-rw-r--r--application/migrations/013_add_multipaste.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/application/migrations/013_add_multipaste.php b/application/migrations/013_add_multipaste.php
new file mode 100644
index 000000000..edb4a0748
--- /dev/null
+++ b/application/migrations/013_add_multipaste.php
@@ -0,0 +1,36 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Migration_add_multipaste extends CI_Migration {
+
+ public function up()
+ {
+ $this->db->query('
+ CREATE TABLE `multipaste` (
+ `url_id` varchar(255) NOT NULL,
+ `multipaste_id` int(11) NOT NULL AUTO_INCREMENT,
+ `user_id` int(11) NOT NULL,
+ `date` int(11) NOT NULL,
+ PRIMARY KEY (`url_id`),
+ UNIQUE KEY `multipaste_id` (`multipaste_id`),
+ KEY `user_id` (`user_id`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
+
+ $this->db->query('
+ CREATE TABLE `multipaste_file_map` (
+ `multipaste_id` int(11) NOT NULL,
+ `file_url_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `sort_order` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`sort_order`),
+ UNIQUE KEY `multipaste_id` (`multipaste_id`,`file_url_id`),
+ KEY `multipaste_file_map_ibfk_2` (`file_url_id`),
+ CONSTRAINT `multipaste_file_map_ibfk_1` FOREIGN KEY (`multipaste_id`) REFERENCES `multipaste` (`multipaste_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `multipaste_file_map_ibfk_2` FOREIGN KEY (`file_url_id`) REFERENCES `files` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;');
+ }
+
+ public function down()
+ {
+ show_error("downgrade not supported");
+ }
+}