summaryrefslogtreecommitdiffstats
path: root/application/migrations/005_drop_file_password.php
blob: 1b3b5fc12290e9247daccc0465c6f59eec8d2f8d (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_Drop_file_password extends CI_Migration {

	public function up()
	{
		$prefix = $this->db->dbprefix;

		if ($this->db->dbdriver == 'postgre') {
			$this->db->query('ALTER TABLE "'.$prefix.'files" DROP "password"');
		} else {
			$this->db->query('ALTER TABLE `'.$prefix.'files` DROP `password`;');
		}
	}

	public function down()
	{
		$prefix = $this->db->dbprefix;

		if ($this->db->dbdriver == 'postgre') {
			$this->db->query('
				ALTER TABLE "'.$prefix.'files"
					ADD "password" character varying(40) DEFAULT NULL
			');
		} else {
			$this->db->query("
				ALTER TABLE `'.$prefix.'files`
					ADD `password` varchar(40) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL;
			");
		}
	}
}