From e4ee81d800a08a5839dcfeeb3441f2f0b4247a6f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 17 Dec 2011 12:06:24 +0100 Subject: use migrations; automatically set up the database Signed-off-by: Florian Pritz --- application/migrations/001_add_files.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 application/migrations/001_add_files.php (limited to 'application/migrations') diff --git a/application/migrations/001_add_files.php b/application/migrations/001_add_files.php new file mode 100644 index 000000000..f1f16ea3a --- /dev/null +++ b/application/migrations/001_add_files.php @@ -0,0 +1,27 @@ +db->query(" + CREATE TABLE IF NOT EXISTS `files` ( + `hash` varchar(32) CHARACTER SET ascii NOT NULL, + `id` varchar(6) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, + `filename` varchar(256) COLLATE utf8_bin NOT NULL, + `password` varchar(40) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL, + `date` int(11) unsigned NOT NULL, + `mimetype` varchar(255) CHARACTER SET ascii NOT NULL, + PRIMARY KEY (`id`), + KEY `date` (`date`), + KEY `hash` (`hash`,`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + "); + } + + public function down() + { + $this->dbforge->drop_table('files'); + } +} -- cgit v1.2.3-24-g4f1b