summaryrefslogtreecommitdiffstats
path: root/application/migrations/001_add_files.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-12-17 12:06:24 +0100
committerFlorian Pritz <bluewind@xinu.at>2011-12-17 12:07:57 +0100
commite4ee81d800a08a5839dcfeeb3441f2f0b4247a6f (patch)
treee4f3740e00f1cdbe08b6c451a72b3c6cf60f209e /application/migrations/001_add_files.php
parentb11b171bc8054d0734176527d80415227502a37d (diff)
use migrations; automatically set up the database
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/migrations/001_add_files.php')
-rw-r--r--application/migrations/001_add_files.php27
1 files changed, 27 insertions, 0 deletions
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 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Migration_Add_files extends CI_Migration {
+
+ public function up()
+ {
+ $this->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');
+ }
+}