alter table SS_MENU drop foreign key FKB9A637DE9BD5850E; alter table SS_MODULES drop foreign key FK468404886E6ACC7C; alter table SS_ORDERS drop foreign key FKED13DDA45EB284E8; alter table SS_ORDER_ITEM drop foreign key FK5FAFF8C34AD259AC; alter table SS_ORDER_ITEM drop foreign key FK5FAFF8C369FBB5CC; alter table SS_PERMIS_RESC drop foreign key FK2EE36D69937EC465; alter table SS_PERMIS_RESC drop foreign key FK2EE36D69946CDA6F; alter table SS_PRODUCT drop foreign key FKEAE8A9F0CBF92AD7; alter table SS_PRODUCT drop foreign key FKEAE8A9F02DBF0E8; alter table SS_PRODUCT drop foreign key FKEAE8A9F0ABE26495; alter table SS_RESOURCES drop foreign key FK9BE45AE696813F7A; alter table SS_ROLE_PERMIS drop foreign key FKB02384A4671BDB3A; alter table SS_ROLE_PERMIS drop foreign key FKB02384A4946CDA6F; alter table SS_USER_ROLE drop foreign key FK2816814BC469F1A; alter table SS_USER_ROLE drop foreign key FK2816814B671BDB3A; drop table if exists SS_CATEGORY; drop table if exists SS_CUSTOMER; drop table if exists SS_MENU; drop table if exists SS_MENU_ROLE; drop table if exists SS_MODULES; drop table if exists SS_ORDERS; drop table if exists SS_ORDER_ITEM; drop table if exists SS_PERMISSIONS; drop table if exists SS_PERMIS_RESC; drop table if exists SS_PRODUCT; drop table if exists SS_RESOURCES; drop table if exists SS_ROLES; drop table if exists SS_ROLE_PERMIS; drop table if exists SS_USERS; drop table if exists SS_USER_ROLE; create table SS_CATEGORY (ID integer not null auto_increment, NAME varchar(255) not null, DESCN varchar(255), primary key (ID)); create table SS_CUSTOMER (ID integer not null auto_increment, NAME varchar(255) not null, LOGINID varchar(255) not null, PASSWD varchar(255) not null, EMAIL varchar(255), STATUS varchar(255), ADDRESS varchar(255), primary key (ID)); create table SS_MENU (ID integer not null auto_increment, PARENT_ID integer, SEQ integer, TITLE varchar(255) not null, TIP varchar(255), DESCN varchar(255), IMAGE varchar(255), FORWARD varchar(255), TARGET varchar(255), primary key (ID)); create table SS_MENU_ROLE (ROLE_ID integer not null, MENU_ID integer not null, primary key (ROLE_ID, MENU_ID)); create table SS_MODULES (ID integer not null auto_increment, PARENT_ID integer not null, TITLE varchar(255) not null, DESCN varchar(255), ACTIVE integer not null, primary key (ID)); create table SS_ORDERS (ID integer not null auto_increment, ORDERDATE datetime not null, TOTALPRICE double precision not null, ORIGINALPRICE double precision, APPLYRULES varchar(255), REGION varchar(255), SHIPADDR varchar(255), SHIPDATE datetime, STATUS varchar(255), CUSTOMER_ID integer not null, primary key (ID)); create table SS_ORDER_ITEM (ORDER_ID integer not null, PRODUCT_ID integer not null, quantity integer not null, unitprice double precision not null, linenum integer not null, primary key (ORDER_ID, linenum)); create table SS_PERMISSIONS (ID integer not null auto_increment, NAME varchar(255) not null, DESCN varchar(255), OPERATION varchar(255), STATUS varchar(255), primary key (ID)); create table SS_PERMIS_RESC (PERMIS_ID integer not null, RESC_ID integer not null, primary key (PERMIS_ID, RESC_ID)); create table SS_PRODUCT (ID integer not null auto_increment, type varchar(255) not null, NAME varchar(255) not null, INVENTORY integer, DESCN varchar(255), UNITPRICE double precision, STATUS varchar(255), CATEGORY_ID integer not null, CREATETIME datetime, CREATE_USER_ID integer, MODIFYTIME datetime, MODIFY_USER_ID integer, ATTR1 varchar(255), ATTR2 varchar(255), ATTR3 varchar(255), ATTR4 varchar(255), primary key (ID)); create table SS_RESOURCES (ID integer not null auto_increment, NAME varchar(255) not null, MODULE_ID integer not null, RES_TYPE varchar(255) not null, RES_STRING varchar(255) not null, DESCN varchar(255), primary key (ID)); create table SS_ROLES (ID integer not null auto_increment, NAME varchar(255) not null, DESCN varchar(255), primary key (ID)); create table SS_ROLE_PERMIS (PERMIS_ID integer not null, ROLE_ID integer not null, primary key (ROLE_ID, PERMIS_ID)); create table SS_USERS (ID integer not null auto_increment, LOGINID varchar(255) not null, PASSWD varchar(255) not null, NAME varchar(255) not null, EMAIL varchar(255), REGION varchar(255), STATUS varchar(255), DESCN varchar(255), primary key (ID)); create table SS_USER_ROLE (ROLE_ID integer not null, USER_ID integer not null, primary key (USER_ID, ROLE_ID)); alter table SS_MENU add index FKB9A637DE9BD5850E (PARENT_ID), add constraint FKB9A637DE9BD5850E foreign key (PARENT_ID) references SS_MENU (ID); alter table SS_MODULES add index FK468404886E6ACC7C (PARENT_ID), add constraint FK468404886E6ACC7C foreign key (PARENT_ID) references SS_MODULES (ID); alter table SS_ORDERS add index FKED13DDA45EB284E8 (CUSTOMER_ID), add constraint FKED13DDA45EB284E8 foreign key (CUSTOMER_ID) references SS_CUSTOMER (ID); alter table SS_ORDER_ITEM add index FK5FAFF8C34AD259AC (PRODUCT_ID), add constraint FK5FAFF8C34AD259AC foreign key (PRODUCT_ID) references SS_PRODUCT (ID); alter table SS_ORDER_ITEM add index FK5FAFF8C369FBB5CC (ORDER_ID), add constraint FK5FAFF8C369FBB5CC foreign key (ORDER_ID) references SS_ORDERS (ID); alter table SS_PERMIS_RESC add index FK2EE36D69937EC465 (RESC_ID), add constraint FK2EE36D69937EC465 foreign key (RESC_ID) references SS_RESOURCES (ID); alter table SS_PERMIS_RESC add index FK2EE36D69946CDA6F (PERMIS_ID), add constraint FK2EE36D69946CDA6F foreign key (PERMIS_ID) references SS_PERMISSIONS (ID); alter table SS_PRODUCT add index FKEAE8A9F0CBF92AD7 (CREATE_USER_ID), add constraint FKEAE8A9F0CBF92AD7 foreign key (CREATE_USER_ID) references SS_USERS (ID); alter table SS_PRODUCT add index FKEAE8A9F02DBF0E8 (CATEGORY_ID), add constraint FKEAE8A9F02DBF0E8 foreign key (CATEGORY_ID) references SS_CATEGORY (ID); alter table SS_PRODUCT add index FKEAE8A9F0ABE26495 (MODIFY_USER_ID), add constraint FKEAE8A9F0ABE26495 foreign key (MODIFY_USER_ID) references SS_USERS (ID); alter table SS_RESOURCES add index FK9BE45AE696813F7A (MODULE_ID), add constraint FK9BE45AE696813F7A foreign key (MODULE_ID) references SS_MODULES (ID); alter table SS_ROLE_PERMIS add index FKB02384A4671BDB3A (ROLE_ID), add constraint FKB02384A4671BDB3A foreign key (ROLE_ID) references SS_ROLES (ID); alter table SS_ROLE_PERMIS add index FKB02384A4946CDA6F (PERMIS_ID), add constraint FKB02384A4946CDA6F foreign key (PERMIS_ID) references SS_PERMISSIONS (ID); alter table SS_USER_ROLE add index FK2816814BC469F1A (USER_ID), add constraint FK2816814BC469F1A foreign key (USER_ID) references SS_USERS (ID); alter table SS_USER_ROLE add index FK2816814B671BDB3A (ROLE_ID), add constraint FK2816814B671BDB3A foreign key (ROLE_ID) references SS_ROLES (ID);