00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 $installer = $this;
00028
00029
00030 $installer->startSetup();
00031
00032 $installer->run("
00033
00034 -- DROP TABLE IF EXISTS {$this->getTable('api_assert')};
00035 CREATE TABLE {$this->getTable('api_assert')} (
00036 `assert_id` int(10) unsigned NOT NULL auto_increment,
00037 `assert_type` varchar(20) character set utf8 NOT NULL default '',
00038 `assert_data` text character set utf8,
00039 PRIMARY KEY (`assert_id`)
00040 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Api ACL Asserts';
00041
00042 -- DROP TABLE IF EXISTS {$this->getTable('api_role')};
00043 CREATE TABLE {$this->getTable('api_role')} (
00044 `role_id` int(10) unsigned NOT NULL auto_increment,
00045 `parent_id` int(10) unsigned NOT NULL default '0',
00046 `tree_level` tinyint(3) unsigned NOT NULL default '0',
00047 `sort_order` tinyint(3) unsigned NOT NULL default '0',
00048 `role_type` char(1) character set utf8 NOT NULL default '0',
00049 `user_id` int(11) unsigned NOT NULL default '0',
00050 `role_name` varchar(50) character set utf8 NOT NULL default '',
00051 PRIMARY KEY (`role_id`),
00052 KEY `parent_id` (`parent_id`,`sort_order`),
00053 KEY `tree_level` (`tree_level`)
00054 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Api ACL Roles';
00055
00056 -- DROP TABLE IF EXISTS {$this->getTable('api_rule')};
00057 CREATE TABLE {$this->getTable('api_rule')} (
00058 `rule_id` int(10) unsigned NOT NULL auto_increment,
00059 `role_id` int(10) unsigned NOT NULL default '0',
00060 `resource_id` varchar(255) character set utf8 NOT NULL default '',
00061 `privileges` varchar(20) character set utf8 NOT NULL default '',
00062 `assert_id` int(10) unsigned NOT NULL default '0',
00063 `role_type` char(1) default NULL,
00064 `permission` varchar(10) default NULL,
00065 PRIMARY KEY (`rule_id`),
00066 KEY `resource` (`resource_id`,`role_id`),
00067 KEY `role_id` (`role_id`,`resource_id`),
00068 CONSTRAINT `FK_api_rule` FOREIGN KEY (`role_id`) REFERENCES {$this->getTable('api_role')} (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE
00069 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Api ACL Rules';
00070
00071 -- DROP TABLE IF EXISTS {$this->getTable('api_user')};
00072 CREATE TABLE {$this->getTable('api_user')} (
00073 `user_id` mediumint(9) unsigned NOT NULL auto_increment,
00074 `firstname` varchar(32) character set utf8 NOT NULL default '',
00075 `lastname` varchar(32) character set utf8 NOT NULL default '',
00076 `email` varchar(128) character set utf8 NOT NULL default '',
00077 `username` varchar(40) character set utf8 NOT NULL default '',
00078 `api_key` varchar(40) character set utf8 NOT NULL default '',
00079 `created` datetime NOT NULL default '0000-00-00 00:00:00',
00080 `modified` datetime default NULL,
00081 `logdate` datetime default NULL,
00082 `lognum` smallint(5) unsigned NOT NULL default '0',
00083 `reload_acl_flag` tinyint(1) NOT NULL default '0',
00084 `is_active` tinyint(1) NOT NULL default '1',
00085 PRIMARY KEY (`user_id`)
00086 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Api Users';
00087
00088 ");
00089
00090 $installer->endSetup();