-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_db.sql
More file actions
7 lines (6 loc) · 2.58 KB
/
create_db.sql
File metadata and controls
7 lines (6 loc) · 2.58 KB
1
2
3
4
5
6
CREATE TABLE app_table (id integer(10) NOT NULL, time integer(10) NOT NULL, status varchar(255) NOT NULL, name varchar(255) NOT NULL, commentary varchar(255), is_deleted integer(10), x_coord integer(10), y_coord integer(10), height integer(10), width integer(10), PRIMARY KEY (id, time));
CREATE TABLE app_attribute (id integer(10) NOT NULL, time integer(10) NOT NULL, status varchar(255) NOT NULL, name varchar(255) NOT NULL, type varchar(255) NOT NULL, definition varchar(255), commentary varchar(255), is_primary integer(10), is_nullable integer(10), is_unique integer(10), is_deleted integer(10), table_id integer(10), table_time integer(10), PRIMARY KEY (id, time), FOREIGN KEY(table_id, table_time) REFERENCES app_table(id, time) ON DELETE Cascade);
CREATE TABLE app_index (id integer(10) NOT NULL, time integer(10) NOT NULL, status varchar(255) NOT NULL, name varchar(255) NOT NULL, commentary varchar(255), is_deleted integer(10), table_id integer(10), table_time integer(10), PRIMARY KEY (id, time), FOREIGN KEY(table_id, table_time) REFERENCES app_table(id, time) ON DELETE Cascade);
CREATE TABLE app_index_attribute (id integer(10) NOT NULL, time integer(10) NOT NULL, status varchar(255), is_deleted integer(10), attribute_id integer(10), attribute_time integer(10), index_id integer(10), index_time integer(10), PRIMARY KEY (id, time), FOREIGN KEY(index_id, index_time) REFERENCES app_index(id, time) ON DELETE Cascade, FOREIGN KEY(attribute_id, attribute_time) REFERENCES app_attribute(id, time) ON DELETE Cascade);
CREATE TABLE app_relation (id integer(10) NOT NULL, time integer(10) NOT NULL, status varchar(255) NOT NULL, identify integer(10), is_deleted integer(10), table_to_id integer(10), table_from_id integer(10), table_to_time integer(10), table_from_time integer(10), index_id integer(10), index_time integer(10), cardinality_type integer(10), cardinality_number integer(10), PRIMARY KEY (id, time), FOREIGN KEY(table_to_id, table_to_time) REFERENCES app_table(id, time) ON DELETE Cascade, FOREIGN KEY(table_from_id, table_from_time) REFERENCES app_table(id, time) ON DELETE Cascade, FOREIGN KEY(index_id, index_time) REFERENCES app_index(id, time) ON DELETE Cascade);
CREATE TABLE relation_to_attr (id integer(10) NOT NULL, time integer(10) NOT NULL, status varchar(255), is_deleted integer(10), attribute_id integer(10), attribute_time integer(10), relation_id integer(10), relation_time integer(10), PRIMARY KEY (id, time), FOREIGN KEY(relation_id, relation_time) REFERENCES app_relation(id, time) ON DELETE Cascade, FOREIGN KEY(attribute_id, attribute_time) REFERENCES app_attribute(id, time) ON DELETE Cascade);