summaryrefslogtreecommitdiffstats
path: root/application/migrations/004_add_filesize.php
blob: f2367937a4a26358f13b83c16265634143d308d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_Add_filesize extends CI_Migration {

	public function up()
	{
		if ($this->db->dbdriver == 'postgre') {
			$this->db->query('
				ALTER TABLE "files"
				ADD "filesize" integer NOT NULL
			');
		} else {
			$this->db->query("
				ALTER TABLE `files`
				ADD `filesize` INT UNSIGNED NOT NULL
			");
		}
	}

	public function down()
	{
		if ($this->db->dbdriver == 'postgre') {
			$this->db->query('
				ALTER TABLE "files" DROP "filesize"
			');
		} else {
			$this->db->query('
				ALTER TABLE `files` DROP `filesize`
			');
		}
	}
}