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

class Migration_Add_apikeys extends CI_Migration {

	public function up()
	{
		$this->db->query("
			CREATE TABLE `apikeys` (
				`key` varchar(64) COLLATE utf8_bin NOT NULL,
				`user` int(8) unsigned NOT NULL,
				`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
				`comment` varchar(255) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
				PRIMARY KEY (`key`),
				KEY `user` (`user`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
		");
	}

	public function down()
	{
		$this->dbforge->drop_table('apikeys');
	}
}