diff options
Diffstat (limited to 'application/migrations/004_add_filesize.php')
-rw-r--r-- | application/migrations/004_add_filesize.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/application/migrations/004_add_filesize.php b/application/migrations/004_add_filesize.php new file mode 100644 index 000000000..ca10e7dc3 --- /dev/null +++ b/application/migrations/004_add_filesize.php @@ -0,0 +1,37 @@ +<?php +defined('BASEPATH') OR exit('No direct script access allowed'); + +class Migration_Add_filesize extends CI_Migration { + + public function up() + { + $prefix = $this->db->dbprefix; + + if ($this->db->dbdriver == 'postgre') { + $this->db->query(' + ALTER TABLE "'.$prefix.'files" + ADD "filesize" integer NOT NULL + '); + } else { + $this->db->query(' + ALTER TABLE `'.$prefix.'files` + ADD `filesize` INT UNSIGNED NOT NULL + '); + } + } + + public function down() + { + $prefix = $this->db->dbprefix; + + if ($this->db->dbdriver == 'postgre') { + $this->db->query(' + ALTER TABLE "'.$prefix.'files" DROP "filesize" + '); + } else { + $this->db->query(' + ALTER TABLE `'.$prefix.'files` DROP `filesize` + '); + } + } +} |