1 drop table if exists ldap_oc_mappings; 2 create table ldap_oc_mappings 3 ( 4 id integer unsigned not null primary key auto_increment, 5 name varchar(64) not null, 6 keytbl varchar(64) not null, 7 keycol varchar(64) not null, 8 create_proc varchar(255), 9 delete_proc varchar(255), 10 expect_return tinyint not null 11 ); 12 13 drop table if exists ldap_attr_mappings; 14 create table ldap_attr_mappings 15 ( 16 id integer unsigned not null primary key auto_increment, 17 oc_map_id integer unsigned not null references ldap_oc_mappings(id), 18 name varchar(255) not null, 19 sel_expr varchar(255) not null, 20 sel_expr_u varchar(255), 21 from_tbls varchar(255) not null, 22 join_where varchar(255), 23 add_proc varchar(255), 24 delete_proc varchar(255), 25 param_order tinyint not null, 26 expect_return tinyint not null 27 ); 28 29 drop table if exists ldap_entries; 30 create table ldap_entries 31 ( 32 id integer unsigned not null primary key auto_increment, 33 dn varchar(255) not null, 34 oc_map_id integer unsigned not null references ldap_oc_mappings(id), 35 parent int NOT NULL , 36 keyval int NOT NULL 37 ); 38 39 alter table ldap_entries add 40 constraint unq1_ldap_entries unique 41 ( 42 oc_map_id, 43 keyval 44 ); 45 46 alter table ldap_entries add 47 constraint unq2_ldap_entries unique 48 ( 49 dn 50 ); 51 52 drop table if exists ldap_entry_objclasses; 53 create table ldap_entry_objclasses 54 ( 55 entry_id integer unsigned not null references ldap_entries(id), 56 oc_name varchar(64) 57 ); 58 59