summaryrefslogtreecommitdiffstats
path: root/application/migrations/004_add_filesize.php
blob: 7e5355c148c401e897d65746b76b5a5ef8845b83 (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
34
35
36
37
38
39
<?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`
			');
		}
	}
}