summaryrefslogtreecommitdiffstats
path: root/application/migrations/011_apikeys_add_access_level.php
blob: 29a2f769b2172d547fc679ae3bd2d6eed9e35b2f (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
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_apikeys_add_access_level extends CI_Migration {

	public function up()
	{
		if ($this->db->dbdriver == 'postgre')
		{
			$this->db->query('
				alter table "apikeys" add "access_level" varchar(255) default \'apikey\'
			');
		}
		else
		{
			$this->db->query("
				alter table `apikeys` add `access_level` varchar(255) default 'apikey';
			");
		}
	}

	public function down()
	{
		if ($this->db->dbdriver == 'postgre')
		{
			$this->db->query('
				alter table "apikeys" drop "access_level"
			');
		}
		else
		{
			$this->db->query('
				alter table `apikeys` drop `access_level`
			');
		}
	}
}