|
From: Benjamin C. <bc...@us...> - 2001-09-15 18:45:01
|
Update of /cvsroot/phpbt/phpbt/schemas/old In directory usw-pr-cvs1:/tmp/cvs-serv6855/schemas/old Added Files: perms.sql table_rename.sql Log Message: Moving down --- NEW FILE: perms.sql --- create table auth_group (group_id int unsigned not null, group_name varchar(80) not null, created_by int unsigned not null, created_date bigint unsigned not null, last_modified_by int unsigned not null, last_modified_date bigint unsigned not null, primary key (group_id)); create table auth_perm (perm_id int unsigned not null, perm_name varchar(80) not null, created_by int unsigned not null, created_date bigint unsigned not null, last_modified_by int unsigned not null, last_modified_date bigint unsigned not null, primary key (perm_id)); create table user_group (user_id int unsigned not null, group_id int unsigned not null, created_by int unsigned not null, created_date bigint unsigned not null, primary key (user_id, group_id), key (group_id)); create table user_perm (user_id int unsigned not null, perm_id int unsigned not null, primary key (user_id, perm_id), key (perm_id)); create table group_perm (group_id int unsigned not null, perm_id int unsigned not null, created_by int unsigned not null, created_date bigint unsigned not null, primary key (group_id, perm_id), key (perm_id)); create table bug_group (bug_id int unsigned not null, group_id int unsigned not null, primary key (bug_id, group_id), key (group_id)); create table project_group (project_id int unsigned not null, group_id int unsigned not null, primary key (project_id, group_id), key (group_id)); # Start off with two user levels... insert into auth_group (group_id, group_name) values (1, 'Admin'); insert into auth_group (group_id, group_name) values (2, 'User'); insert into auth_group (group_id, group_name) values (3, 'Developer'); # ... and only two permissions (how quaint) insert into auth_perm (perm_id, perm_name) values (1, 'Admin'); insert into auth_perm (perm_id, perm_name) values (2, 'Editbug'); # Admins can do all the admin stuff and users can edit bugs insert into group_perm (group_id, perm_id) values (1, 1); insert into group_perm (group_id, perm_id) values (2, 2); # And user_id 1 is the admin and a user insert into user_group (user_id, group_id) values (1,0); insert into user_group select user_id, 2, created_by, created_date from auth_user; # You can use these queries to convert the post 0.2.x / pre 0.3.0 schema #alter table user rename auth_user; #alter table auth_user change user_level active tinyint unsigned not null; #alter table auth_user add login char(40) not null after user_id; #update auth_user set active = 1 where active > 0; #update auth_user set login = email; --- NEW FILE: table_rename.sql --- alter table attachment rename phpbt_attachment; alter table bug rename phpbt_bug; alter table bug_history rename phpbt_bug_history; alter table comment rename phpbt_comment; alter table component rename phpbt_component; alter table os rename phpbt_os; alter table project rename phpbt_project; alter table resolution rename phpbt_resolution; alter table saved_query rename phpbt_saved_query; alter table severity rename phpbt_severity; alter table status rename phpbt_status; alter table auth_user rename phpbt_auth_user; alter table version rename phpbt_version; alter table auth_group rename phpbt_auth_group; alter table auth_perm rename phpbt_auth_perm; alter table user_group rename phpbt_user_group; alter table user_perm rename phpbt_user_perm; alter table group_perm rename phpbt_group_perm; alter table bug_group rename phpbt_bug_group; alter table project_group rename phpbt_project_group; |