From fa3de7158eb051cd10067a63671f66fda3b90651 Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Fri, 10 Jan 2020 14:15:50 +1300 Subject: [PATCH] No effective change - update mysql ddl review in src/test/ddl-review --- src/test/ddl-review/mysql-create-all.sql | 389 ++++++++++++++++++----- src/test/ddl-review/mysql-drop-all.sql | 178 +++++++++-- 2 files changed, 469 insertions(+), 98 deletions(-) diff --git a/src/test/ddl-review/mysql-create-all.sql b/src/test/ddl-review/mysql-create-all.sql index 194ce188b..c4081a678 100644 --- a/src/test/ddl-review/mysql-create-all.sql +++ b/src/test/ddl-review/mysql-create-all.sql @@ -1,53 +1,4 @@ --- Generated by ebean unknown at 2019-07-25T09:30:19.924Z --- init script create procs --- Inital script to create stored procedures etc for mysql platform -DROP PROCEDURE IF EXISTS usp_ebean_drop_foreign_keys; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_foreign_keys TABLE, COLUMN --- deletes all constraints and foreign keys referring to TABLE.COLUMN --- -CREATE PROCEDURE usp_ebean_drop_foreign_keys(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN - DECLARE done INT DEFAULT FALSE; - DECLARE c_fk_name CHAR(255); - DECLARE curs CURSOR FOR SELECT CONSTRAINT_NAME from information_schema.KEY_COLUMN_USAGE - WHERE TABLE_SCHEMA = DATABASE() and TABLE_NAME = p_table_name and COLUMN_NAME = p_column_name - AND REFERENCED_TABLE_NAME IS NOT NULL; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN curs; - - read_loop: LOOP - FETCH curs INTO c_fk_name; - IF done THEN - LEAVE read_loop; - END IF; - SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP FOREIGN KEY ', c_fk_name); - PREPARE stmt FROM @sql; - EXECUTE stmt; - END LOOP; - - CLOSE curs; -END -$$ - -DROP PROCEDURE IF EXISTS usp_ebean_drop_column; - -delimiter $$ --- --- PROCEDURE: usp_ebean_drop_column TABLE, COLUMN --- deletes the column and ensures that all indices and constraints are dropped first --- -CREATE PROCEDURE usp_ebean_drop_column(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) -BEGIN - CALL usp_ebean_drop_foreign_keys(p_table_name, p_column_name); - SET @sql = CONCAT('ALTER TABLE ', p_table_name, ' DROP COLUMN ', p_column_name); - PREPARE stmt FROM @sql; - EXECUTE stmt; -END -$$ +-- Generated by ebean unknown at 2020-01-10T01:11:55.722473Z create table asimple_bean ( id bigint auto_increment not null, name varchar(255), @@ -112,7 +63,7 @@ create table address ( ); create table o_address ( - id smallint auto_increment not null, + id integer auto_increment not null, line_1 varchar(100), line_2 varchar(100), city varchar(100), @@ -395,6 +346,28 @@ create table ckey_parent ( constraint pk_ckey_parent primary key (one_key,two_key) ); +create table coone ( + id bigint auto_increment not null, + name varchar(255), + constraint pk_coone primary key (id) +); + +create table coone_many ( + id bigint auto_increment not null, + coone_id bigint not null, + name varchar(255), + deleted tinyint(1) default 0 not null, + constraint pk_coone_many primary key (id) +); + +create table coroot ( + id bigint auto_increment not null, + name varchar(255), + one_id bigint, + constraint uq_coroot_one_id unique (one_id), + constraint pk_coroot primary key (id) +); + create table calculation_result ( id integer auto_increment not null, charge double not null, @@ -432,6 +405,8 @@ create table sp_car_car_doors ( create table sa_car ( id bigint auto_increment not null, + brand varchar(255), + sold integer not null, version integer not null, constraint pk_sa_car primary key (id) ); @@ -532,6 +507,7 @@ create table contact ( phone varchar(255), mobile varchar(255), email varchar(255), + is_member tinyint(1) default 0 not null, customer_id integer not null, group_id integer, cretime datetime(6) not null, @@ -602,8 +578,8 @@ create table o_customer ( name varchar(40) not null, smallnote varchar(100) comment 'Short notes regarding the customer', anniversary date comment 'Join date of the customer', - billing_address_id smallint, - shipping_address_id smallint, + billing_address_id integer, + shipping_address_id integer, cretime datetime(6) not null, updtime datetime(6) not null, version bigint not null, @@ -873,7 +849,7 @@ create table earray_bean ( foo integer, name varchar(255), phone_numbers varchar(300), - uids varchar(1000), + uids varchar(1000) not null, other_ids varchar(1000), doubs varchar(1000), statuses varchar(1000), @@ -972,6 +948,13 @@ create table e_basicenc_client ( constraint pk_e_basicenc_client primary key (id) ); +create table e_basicenc_relate ( + id bigint auto_increment not null, + name varchar(255), + other_id integer, + constraint pk_e_basicenc_relate primary key (id) +); + create table e_basic_enum_id ( status varchar(1) not null, name varchar(255), @@ -1165,6 +1148,7 @@ create table e_basicver ( create table e_basic_withlife ( id bigint auto_increment not null, name varchar(255), + other varchar(255), deleted tinyint(1) default 0 not null, version bigint not null, constraint pk_e_basic_withlife primary key (id) @@ -1286,6 +1270,14 @@ create table egen_props ( constraint pk_egen_props primary key (id) ); +create table eid_uid_bean ( + id bigint auto_increment not null, + uuid varchar(40) not null, + name varchar(255), + constraint uq_eid_uid_bean_uuid unique (uuid), + constraint pk_eid_uid_bean primary key (id) +); + create table einvoice ( id bigint auto_increment not null, invoice_date datetime(6), @@ -1585,6 +1577,20 @@ create table ec_person_phone ( phone varchar(255) not null ); +create table ec_top ( + id bigint auto_increment not null, + name varchar(255), + person_id bigint, + version bigint not null, + constraint pk_ec_top primary key (id) +); + +create table ec_top_ecs_person ( + ec_top_id bigint not null, + ecs_person_id bigint not null, + constraint pk_ec_top_ecs_person primary key (ec_top_id,ecs_person_id) +); + create table ecbl_person ( id bigint auto_increment not null, name varchar(255), @@ -1652,6 +1658,40 @@ create table ecs_person_phone ( phone varchar(255) not null ); +create table ecsm_child ( + one_id varchar(40) not null, + ecsm_parent_id bigint not null, + name varchar(255), + version bigint not null, + constraint pk_ecsm_child primary key (one_id) +); + +create table ecsm_values ( + host_id varchar(40) not null, + value varchar(255) not null +); + +create table ecsm_one ( + one_id varchar(40) not null, + name varchar(255), + version bigint not null, + constraint pk_ecsm_one primary key (one_id) +); + +create table ecsm_parent ( + id bigint auto_increment not null, + name varchar(255), + version bigint not null, + constraint pk_ecsm_parent primary key (id) +); + +create table ecsm_two ( + id varchar(40) not null, + name varchar(255), + version bigint not null, + constraint pk_ecsm_two primary key (id) +); + create table td_child ( child_id integer auto_increment not null, child_name varchar(255), @@ -1667,6 +1707,13 @@ create table td_parent ( constraint pk_td_parent primary key (parent_id) ); +create table element_bean ( + id bigint auto_increment not null, + complex_bean_id varchar(40) not null, + value varchar(255) not null, + constraint pk_element_bean primary key (id) +); + create table empl ( id bigint auto_increment not null, name varchar(255), @@ -2478,6 +2525,29 @@ create table noidbean ( when_created datetime(6) not null ); +create table o_bean_child ( + id bigint auto_increment not null, + cached_bean_id bigint, + constraint pk_o_bean_child primary key (id) +); + +create table ocached_app ( + id bigint auto_increment not null, + app_name varchar(255), + version bigint not null, + constraint uq_ocached_app_app_name unique (app_name), + constraint pk_ocached_app primary key (id) +); + +create table ocached_app_detail ( + id bigint auto_increment not null, + app_id bigint not null, + detail varchar(255), + version bigint not null, + constraint uq_ocached_app_detail_app_id_detail unique (app_id,detail), + constraint pk_ocached_app_detail primary key (id) +); + create table o_cached_bean ( id bigint auto_increment not null, name varchar(255), @@ -2522,6 +2592,14 @@ create table o_cached_natkey3 ( constraint pk_o_cached_natkey3 primary key (id) ); +create table ocached_nkey_uid ( + id bigint auto_increment not null, + uid varchar(40), + other varchar(255), + version bigint not null, + constraint pk_ocached_nkey_uid primary key (id) +); + create table ocar ( id integer auto_increment not null, vin varchar(255), @@ -2561,6 +2639,18 @@ create table ogear_box ( constraint pk_ogear_box primary key (id) ); +create table omvertex ( + id varchar(40) not null, + constraint pk_omvertex primary key (id) +); + +create table omvertex_other ( + id varchar(40) not null, + omvertex_id varchar(40) not null, + name varchar(255), + constraint pk_omvertex_other primary key (id) +); + create table oroad_show_msg ( id integer auto_increment not null, company_id integer not null, @@ -2571,6 +2661,21 @@ create table oroad_show_msg ( constraint pk_oroad_show_msg primary key (id) ); +create table om_basic_child ( + id bigint auto_increment not null, + name varchar(255), + parent_id bigint, + version bigint not null, + constraint pk_om_basic_child primary key (id) +); + +create table om_basic_parent ( + id bigint auto_increment not null, + name varchar(255), + version bigint not null, + constraint pk_om_basic_parent primary key (id) +); + create table om_ordered_detail ( id bigint auto_increment not null, name varchar(255), @@ -2990,6 +3095,46 @@ create table password_store_model ( constraint pk_password_store_model primary key (id) ); +create table pcf_calendar ( + id bigint auto_increment not null, + pcf_person_id bigint not null, + version bigint not null, + constraint pk_pcf_calendar primary key (id) +); + +create table pcf_city ( + id bigint auto_increment not null, + pcf_country_id bigint not null, + name varchar(255), + mayor_id bigint not null, + vice_mayor_id bigint not null, + version bigint not null, + constraint uq_pcf_city_mayor_id unique (mayor_id), + constraint uq_pcf_city_vice_mayor_id unique (vice_mayor_id), + constraint pk_pcf_city primary key (id) +); + +create table pcf_country ( + id bigint auto_increment not null, + version bigint not null, + constraint pk_pcf_country primary key (id) +); + +create table pcf_event ( + id bigint auto_increment not null, + pcf_calendar_id bigint not null, + name varchar(255), + version bigint not null, + constraint pk_pcf_event primary key (id) +); + +create table pcf_person ( + id bigint auto_increment not null, + name varchar(255), + version bigint not null, + constraint pk_pcf_person primary key (id) +); + create table mt_permission ( id varchar(40) not null, name varchar(255), @@ -3111,6 +3256,11 @@ create table r_orders ( constraint pk_r_orders primary key (company,order_number) ); +create table referencing_bean ( + id varchar(40) not null, + constraint pk_referencing_bean primary key (id) +); + create table region ( customer integer not null, type integer not null, @@ -3161,6 +3311,14 @@ create table em_role ( constraint pk_em_role primary key (id) ); +create table root_bean ( + dtype varchar(31) not null, + id varchar(40) not null, + referencing_bean_id varchar(40) not null, + value varchar(255), + constraint pk_root_bean primary key (id) +); + create table f_second ( id bigint auto_increment not null, mod_name varchar(255), @@ -3282,6 +3440,15 @@ create table some_period_bean ( constraint pk_some_period_bean primary key (id) ); +create table source_base ( + dtype varchar(31) not null, + id varchar(40) not null, + name varchar(255), + pos integer not null, + target_id varchar(40), + constraint pk_source_base primary key (id) +); + create table stockforecast ( type varchar(31) not null, id bigint auto_increment not null, @@ -3393,15 +3560,6 @@ create table t_detail_with_other_namexxxyy ( constraint pk_t_detail_with_other_namexxxyy primary key (id) ); -create table ts_detail_two ( - id integer auto_increment not null, - name varchar(255), - description varchar(255), - active tinyint(1) default 0 not null, - master_id integer, - constraint pk_ts_detail_two primary key (id) -); - create table t_atable_thatisrelatively ( id integer auto_increment not null, name varchar(255), @@ -3410,12 +3568,21 @@ create table t_atable_thatisrelatively ( constraint pk_t_atable_thatisrelatively primary key (id) ); -create table ts_master_two ( - id integer auto_increment not null, +create table ttruck_holder ( + id bigint auto_increment not null, name varchar(255), - description varchar(255), - active tinyint(1) default 0 not null, - constraint pk_ts_master_two primary key (id) + truck_plate_no varchar(32) not null, + basic_id integer, + version bigint not null, + constraint pk_ttruck_holder primary key (id) +); + +create table ttruck_holder_item ( + id bigint auto_increment not null, + some_uid varchar(40), + foo varchar(255), + owner_id bigint not null, + constraint pk_ttruck_holder_item primary key (id) ); create table tuuid_entity ( @@ -3437,6 +3604,13 @@ create table twith_pre_insert ( constraint pk_twith_pre_insert primary key (id) ); +create table target_base ( + dtype varchar(31) not null, + id varchar(40) not null, + name varchar(255), + constraint pk_target_base primary key (id) +); + create table mt_tenant ( id varchar(40) not null, name varchar(255), @@ -3468,11 +3642,18 @@ create table sa_tire ( constraint pk_sa_tire primary key (id) ); +create table tree_entity ( + id integer auto_increment not null, + text varchar(255), + parent_id integer, + constraint pk_tree_entity primary key (id) +); + create table trip ( id integer auto_increment not null, vehicle_driver_id integer, destination varchar(255), - address_id smallint, + address_id integer, star_date datetime(6), cretime datetime(6) not null, updtime datetime(6) not null, @@ -3637,7 +3818,7 @@ create table vehicle_driver ( id integer auto_increment not null, name varchar(255), vehicle_id integer, - address_id smallint, + address_id integer, license_issued_on datetime(6), cretime datetime(6) not null, updtime datetime(6) not null, @@ -3735,6 +3916,7 @@ create table zones ( create index ix_contact_last_name_first_name on contact (last_name,first_name); create index ix_e_basic_name on e_basic (name); create index ix_efile2_no_fk_owner_id on efile2_no_fk (owner_id); +create index ix_ecsm_values_host_id on ecsm_values (host_id); create index ix_organization_node_kind on organization_node (kind); create index ix_bar_foo_id on bar (foo_id); alter table bar add constraint fk_bar_foo_id foreign key (foo_id) references foo (foo_id) on delete restrict on update restrict; @@ -3810,6 +3992,11 @@ alter table ckey_detail add constraint fk_ckey_detail_parent foreign key (one_ke create index ix_ckey_parent_assoc_id on ckey_parent (assoc_id); alter table ckey_parent add constraint fk_ckey_parent_assoc_id foreign key (assoc_id) references ckey_assoc (id) on delete restrict on update restrict; +create index ix_coone_many_coone_id on coone_many (coone_id); +alter table coone_many add constraint fk_coone_many_coone_id foreign key (coone_id) references coone (id) on delete restrict on update restrict; + +alter table coroot add constraint fk_coroot_one_id foreign key (one_id) references coone (id) on delete restrict on update restrict; + create index ix_calculation_result_product_configuration_id on calculation_result (product_configuration_id); alter table calculation_result add constraint fk_calculation_result_product_configuration_id foreign key (product_configuration_id) references configuration (id) on delete restrict on update restrict; @@ -3931,6 +4118,9 @@ alter table document_media add constraint fk_document_media_document_id foreign create index ix_document_media_draft_document_id on document_media_draft (document_id); alter table document_media_draft add constraint fk_document_media_draft_document_id foreign key (document_id) references document_draft (id) on delete restrict on update restrict; +create index ix_e_basicenc_relate_other_id on e_basicenc_relate (other_id); +alter table e_basicenc_relate add constraint fk_e_basicenc_relate_other_id foreign key (other_id) references e_basicenc (id) on delete restrict on update restrict; + create index ix_ebasic_json_map_detail_owner_id on ebasic_json_map_detail (owner_id); alter table ebasic_json_map_detail add constraint fk_ebasic_json_map_detail_owner_id foreign key (owner_id) references ebasic_json_map (id) on delete restrict on update restrict; @@ -4007,6 +4197,15 @@ alter table ec_enum_person_tags add constraint fk_ec_enum_person_tags_ec_enum_pe create index ix_ec_person_phone_owner_id on ec_person_phone (owner_id); alter table ec_person_phone add constraint fk_ec_person_phone_owner_id foreign key (owner_id) references ec_person (id) on delete restrict on update restrict; +create index ix_ec_top_person_id on ec_top (person_id); +alter table ec_top add constraint fk_ec_top_person_id foreign key (person_id) references ecs_person (id) on delete restrict on update restrict; + +create index ix_ec_top_ecs_person_ec_top on ec_top_ecs_person (ec_top_id); +alter table ec_top_ecs_person add constraint fk_ec_top_ecs_person_ec_top foreign key (ec_top_id) references ec_top (id) on delete restrict on update restrict; + +create index ix_ec_top_ecs_person_ecs_person on ec_top_ecs_person (ecs_person_id); +alter table ec_top_ecs_person add constraint fk_ec_top_ecs_person_ecs_person foreign key (ecs_person_id) references ecs_person (id) on delete restrict on update restrict; + create index ix_ecbl_person_phone_numbers_person_id on ecbl_person_phone_numbers (person_id); alter table ecbl_person_phone_numbers add constraint fk_ecbl_person_phone_numbers_person_id foreign key (person_id) references ecbl_person (id) on delete restrict on update restrict; @@ -4022,9 +4221,15 @@ alter table ecmc_person_phone_numbers add constraint fk_ecmc_person_phone_number create index ix_ecs_person_phone_ecs_person_id on ecs_person_phone (ecs_person_id); alter table ecs_person_phone add constraint fk_ecs_person_phone_ecs_person_id foreign key (ecs_person_id) references ecs_person (id) on delete restrict on update restrict; +create index ix_ecsm_child_ecsm_parent_id on ecsm_child (ecsm_parent_id); +alter table ecsm_child add constraint fk_ecsm_child_ecsm_parent_id foreign key (ecsm_parent_id) references ecsm_parent (id) on delete restrict on update restrict; + create index ix_td_child_parent_id on td_child (parent_id); alter table td_child add constraint fk_td_child_parent_id foreign key (parent_id) references td_parent (parent_id) on delete restrict on update restrict; +create index ix_element_bean_complex_bean_id on element_bean (complex_bean_id); +alter table element_bean add constraint fk_element_bean_complex_bean_id foreign key (complex_bean_id) references root_bean (id) on delete restrict on update restrict; + create index ix_empl_default_address_id on empl (default_address_id); alter table empl add constraint fk_empl_default_address_id foreign key (default_address_id) references addr (id) on delete restrict on update restrict; @@ -4232,6 +4437,12 @@ alter table ms_many_b_many_a add constraint fk_ms_many_b_many_a_ms_many_a foreig create index ix_my_lob_size_join_many_parent_id on my_lob_size_join_many (parent_id); alter table my_lob_size_join_many add constraint fk_my_lob_size_join_many_parent_id foreign key (parent_id) references my_lob_size (id) on delete restrict on update restrict; +create index ix_o_bean_child_cached_bean_id on o_bean_child (cached_bean_id); +alter table o_bean_child add constraint fk_o_bean_child_cached_bean_id foreign key (cached_bean_id) references o_cached_bean (id) on delete restrict on update restrict; + +create index ix_ocached_app_detail_app_id on ocached_app_detail (app_id); +alter table ocached_app_detail add constraint fk_ocached_app_detail_app_id foreign key (app_id) references ocached_app (id) on delete restrict on update restrict; + create index ix_o_cached_bean_country_o_cached_bean on o_cached_bean_country (o_cached_bean_id); alter table o_cached_bean_country add constraint fk_o_cached_bean_country_o_cached_bean foreign key (o_cached_bean_id) references o_cached_bean (id) on delete restrict on update restrict; @@ -4245,8 +4456,14 @@ alter table oengine add constraint fk_oengine_car_id foreign key (car_id) refere alter table ogear_box add constraint fk_ogear_box_car_id foreign key (car_id) references ocar (id) on delete restrict on update restrict; +create index ix_omvertex_other_omvertex_id on omvertex_other (omvertex_id); +alter table omvertex_other add constraint fk_omvertex_other_omvertex_id foreign key (omvertex_id) references omvertex (id) on delete restrict on update restrict; + alter table oroad_show_msg add constraint fk_oroad_show_msg_company_id foreign key (company_id) references ocompany (id) on delete restrict on update restrict; +create index ix_om_basic_child_parent_id on om_basic_child (parent_id); +alter table om_basic_child add constraint fk_om_basic_child_parent_id foreign key (parent_id) references om_basic_parent (id) on delete restrict on update restrict; + create index ix_om_ordered_detail_master_id on om_ordered_detail (master_id); alter table om_ordered_detail add constraint fk_om_ordered_detail_master_id foreign key (master_id) references om_ordered_master (id) on delete restrict on update restrict; @@ -4327,6 +4544,19 @@ alter table c_participation add constraint fk_c_participation_conversation_id fo create index ix_c_participation_user_id on c_participation (user_id); alter table c_participation add constraint fk_c_participation_user_id foreign key (user_id) references c_user (id) on delete restrict on update restrict; +create index ix_pcf_calendar_pcf_person_id on pcf_calendar (pcf_person_id); +alter table pcf_calendar add constraint fk_pcf_calendar_pcf_person_id foreign key (pcf_person_id) references pcf_person (id) on delete restrict on update restrict; + +create index ix_pcf_city_pcf_country_id on pcf_city (pcf_country_id); +alter table pcf_city add constraint fk_pcf_city_pcf_country_id foreign key (pcf_country_id) references pcf_country (id) on delete restrict on update restrict; + +alter table pcf_city add constraint fk_pcf_city_mayor_id foreign key (mayor_id) references pcf_person (id) on delete restrict on update restrict; + +alter table pcf_city add constraint fk_pcf_city_vice_mayor_id foreign key (vice_mayor_id) references pcf_person (id) on delete restrict on update restrict; + +create index ix_pcf_event_pcf_calendar_id on pcf_event (pcf_calendar_id); +alter table pcf_event add constraint fk_pcf_event_pcf_calendar_id foreign key (pcf_calendar_id) references pcf_calendar (id) on delete restrict on update restrict; + alter table persistent_file_content add constraint fk_persistent_file_content_persistent_file_id foreign key (persistent_file_id) references persistent_file (id) on delete restrict on update restrict; create index ix_person_default_address_oid on person (default_address_oid); @@ -4368,6 +4598,9 @@ alter table mt_role_permission add constraint fk_mt_role_permission_mt_role fore create index ix_mt_role_permission_mt_permission on mt_role_permission (mt_permission_id); alter table mt_role_permission add constraint fk_mt_role_permission_mt_permission foreign key (mt_permission_id) references mt_permission (id) on delete restrict on update restrict; +create index ix_root_bean_referencing_bean_id on root_bean (referencing_bean_id); +alter table root_bean add constraint fk_root_bean_referencing_bean_id foreign key (referencing_bean_id) references referencing_bean (id) on delete restrict on update restrict; + alter table f_second add constraint fk_f_second_first foreign key (first) references f_first (id) on delete restrict on update restrict; create index ix_section_article_id on section (article_id); @@ -4391,6 +4624,9 @@ alter table site add constraint fk_site_data_container_id foreign key (data_cont alter table site add constraint fk_site_site_address_id foreign key (site_address_id) references site_address (id) on delete restrict on update restrict; +create index ix_source_base_target_id on source_base (target_id); +alter table source_base add constraint fk_source_base_target_id foreign key (target_id) references target_base (id) on delete restrict on update restrict; + create index ix_stockforecast_inner_report_id on stockforecast (inner_report_id); alter table stockforecast add constraint fk_stockforecast_inner_report_id foreign key (inner_report_id) references inner_report (id) on delete restrict on update restrict; @@ -4405,14 +4641,23 @@ alter table tevent_one add constraint fk_tevent_one_event_id foreign key (event_ create index ix_t_detail_with_other_namexxxyy_master_id on t_detail_with_other_namexxxyy (master_id); alter table t_detail_with_other_namexxxyy add constraint fk_t_detail_with_other_namexxxyy_master_id foreign key (master_id) references t_atable_thatisrelatively (id) on delete restrict on update restrict; -create index ix_ts_detail_two_master_id on ts_detail_two (master_id); -alter table ts_detail_two add constraint fk_ts_detail_two_master_id foreign key (master_id) references ts_master_two (id) on delete restrict on update restrict; +create index ix_ttruck_holder_truck_plate_no on ttruck_holder (truck_plate_no); +alter table ttruck_holder add constraint fk_ttruck_holder_truck_plate_no foreign key (truck_plate_no) references tcar (plate_no) on delete restrict on update restrict; + +create index ix_ttruck_holder_basic_id on ttruck_holder (basic_id); +alter table ttruck_holder add constraint fk_ttruck_holder_basic_id foreign key (basic_id) references e_basic (id) on delete restrict on update restrict; + +create index ix_ttruck_holder_item_owner_id on ttruck_holder_item (owner_id); +alter table ttruck_holder_item add constraint fk_ttruck_holder_item_owner_id foreign key (owner_id) references ttruck_holder (id) on delete restrict on update restrict; create index ix_twheel_owner_plate_no on twheel (owner_plate_no); alter table twheel add constraint fk_twheel_owner_plate_no foreign key (owner_plate_no) references tcar (plate_no) on delete restrict on update restrict; alter table tire add constraint fk_tire_wheel foreign key (wheel) references wheel (id) on delete restrict on update restrict; +create index ix_tree_entity_parent_id on tree_entity (parent_id); +alter table tree_entity add constraint fk_tree_entity_parent_id foreign key (parent_id) references tree_entity (id) on delete restrict on update restrict; + create index ix_trip_vehicle_driver_id on trip (vehicle_driver_id); alter table trip add constraint fk_trip_vehicle_driver_id foreign key (vehicle_driver_id) references vehicle_driver (id) on delete restrict on update restrict; diff --git a/src/test/ddl-review/mysql-drop-all.sql b/src/test/ddl-review/mysql-drop-all.sql index 1484b2eba..8168812a8 100644 --- a/src/test/ddl-review/mysql-drop-all.sql +++ b/src/test/ddl-review/mysql-drop-all.sql @@ -1,4 +1,4 @@ --- Generated by ebean unknown at 2019-07-25T09:30:19.924Z +-- Generated by ebean unknown at 2020-01-10T01:11:55.722473Z alter table bar drop foreign key fk_bar_foo_id; drop index ix_bar_foo_id on bar; @@ -73,6 +73,11 @@ drop index ix_ckey_detail_parent on ckey_detail; alter table ckey_parent drop foreign key fk_ckey_parent_assoc_id; drop index ix_ckey_parent_assoc_id on ckey_parent; +alter table coone_many drop foreign key fk_coone_many_coone_id; +drop index ix_coone_many_coone_id on coone_many; + +alter table coroot drop foreign key fk_coroot_one_id; + alter table calculation_result drop foreign key fk_calculation_result_product_configuration_id; drop index ix_calculation_result_product_configuration_id on calculation_result; @@ -194,6 +199,9 @@ drop index ix_document_media_document_id on document_media; alter table document_media_draft drop foreign key fk_document_media_draft_document_id; drop index ix_document_media_draft_document_id on document_media_draft; +alter table e_basicenc_relate drop foreign key fk_e_basicenc_relate_other_id; +drop index ix_e_basicenc_relate_other_id on e_basicenc_relate; + alter table ebasic_json_map_detail drop foreign key fk_ebasic_json_map_detail_owner_id; drop index ix_ebasic_json_map_detail_owner_id on ebasic_json_map_detail; @@ -270,6 +278,15 @@ drop index ix_ec_enum_person_tags_ec_enum_person_id on ec_enum_person_tags; alter table ec_person_phone drop foreign key fk_ec_person_phone_owner_id; drop index ix_ec_person_phone_owner_id on ec_person_phone; +alter table ec_top drop foreign key fk_ec_top_person_id; +drop index ix_ec_top_person_id on ec_top; + +alter table ec_top_ecs_person drop foreign key fk_ec_top_ecs_person_ec_top; +drop index ix_ec_top_ecs_person_ec_top on ec_top_ecs_person; + +alter table ec_top_ecs_person drop foreign key fk_ec_top_ecs_person_ecs_person; +drop index ix_ec_top_ecs_person_ecs_person on ec_top_ecs_person; + alter table ecbl_person_phone_numbers drop foreign key fk_ecbl_person_phone_numbers_person_id; drop index ix_ecbl_person_phone_numbers_person_id on ecbl_person_phone_numbers; @@ -285,9 +302,15 @@ drop index ix_ecmc_person_phone_numbers_ecmc_person_id on ecmc_person_phone_numb alter table ecs_person_phone drop foreign key fk_ecs_person_phone_ecs_person_id; drop index ix_ecs_person_phone_ecs_person_id on ecs_person_phone; +alter table ecsm_child drop foreign key fk_ecsm_child_ecsm_parent_id; +drop index ix_ecsm_child_ecsm_parent_id on ecsm_child; + alter table td_child drop foreign key fk_td_child_parent_id; drop index ix_td_child_parent_id on td_child; +alter table element_bean drop foreign key fk_element_bean_complex_bean_id; +drop index ix_element_bean_complex_bean_id on element_bean; + alter table empl drop foreign key fk_empl_default_address_id; drop index ix_empl_default_address_id on empl; @@ -495,6 +518,12 @@ drop index ix_ms_many_b_many_a_ms_many_a on ms_many_b_many_a; alter table my_lob_size_join_many drop foreign key fk_my_lob_size_join_many_parent_id; drop index ix_my_lob_size_join_many_parent_id on my_lob_size_join_many; +alter table o_bean_child drop foreign key fk_o_bean_child_cached_bean_id; +drop index ix_o_bean_child_cached_bean_id on o_bean_child; + +alter table ocached_app_detail drop foreign key fk_ocached_app_detail_app_id; +drop index ix_ocached_app_detail_app_id on ocached_app_detail; + alter table o_cached_bean_country drop foreign key fk_o_cached_bean_country_o_cached_bean; drop index ix_o_cached_bean_country_o_cached_bean on o_cached_bean_country; @@ -508,8 +537,14 @@ alter table oengine drop foreign key fk_oengine_car_id; alter table ogear_box drop foreign key fk_ogear_box_car_id; +alter table omvertex_other drop foreign key fk_omvertex_other_omvertex_id; +drop index ix_omvertex_other_omvertex_id on omvertex_other; + alter table oroad_show_msg drop foreign key fk_oroad_show_msg_company_id; +alter table om_basic_child drop foreign key fk_om_basic_child_parent_id; +drop index ix_om_basic_child_parent_id on om_basic_child; + alter table om_ordered_detail drop foreign key fk_om_ordered_detail_master_id; drop index ix_om_ordered_detail_master_id on om_ordered_detail; @@ -590,6 +625,19 @@ drop index ix_c_participation_conversation_id on c_participation; alter table c_participation drop foreign key fk_c_participation_user_id; drop index ix_c_participation_user_id on c_participation; +alter table pcf_calendar drop foreign key fk_pcf_calendar_pcf_person_id; +drop index ix_pcf_calendar_pcf_person_id on pcf_calendar; + +alter table pcf_city drop foreign key fk_pcf_city_pcf_country_id; +drop index ix_pcf_city_pcf_country_id on pcf_city; + +alter table pcf_city drop foreign key fk_pcf_city_mayor_id; + +alter table pcf_city drop foreign key fk_pcf_city_vice_mayor_id; + +alter table pcf_event drop foreign key fk_pcf_event_pcf_calendar_id; +drop index ix_pcf_event_pcf_calendar_id on pcf_event; + alter table persistent_file_content drop foreign key fk_persistent_file_content_persistent_file_id; alter table person drop foreign key fk_person_default_address_oid; @@ -631,6 +679,9 @@ drop index ix_mt_role_permission_mt_role on mt_role_permission; alter table mt_role_permission drop foreign key fk_mt_role_permission_mt_permission; drop index ix_mt_role_permission_mt_permission on mt_role_permission; +alter table root_bean drop foreign key fk_root_bean_referencing_bean_id; +drop index ix_root_bean_referencing_bean_id on root_bean; + alter table f_second drop foreign key fk_f_second_first; alter table section drop foreign key fk_section_article_id; @@ -654,6 +705,9 @@ alter table site drop foreign key fk_site_data_container_id; alter table site drop foreign key fk_site_site_address_id; +alter table source_base drop foreign key fk_source_base_target_id; +drop index ix_source_base_target_id on source_base; + alter table stockforecast drop foreign key fk_stockforecast_inner_report_id; drop index ix_stockforecast_inner_report_id on stockforecast; @@ -668,14 +722,23 @@ alter table tevent_one drop foreign key fk_tevent_one_event_id; alter table t_detail_with_other_namexxxyy drop foreign key fk_t_detail_with_other_namexxxyy_master_id; drop index ix_t_detail_with_other_namexxxyy_master_id on t_detail_with_other_namexxxyy; -alter table ts_detail_two drop foreign key fk_ts_detail_two_master_id; -drop index ix_ts_detail_two_master_id on ts_detail_two; +alter table ttruck_holder drop foreign key fk_ttruck_holder_truck_plate_no; +drop index ix_ttruck_holder_truck_plate_no on ttruck_holder; + +alter table ttruck_holder drop foreign key fk_ttruck_holder_basic_id; +drop index ix_ttruck_holder_basic_id on ttruck_holder; + +alter table ttruck_holder_item drop foreign key fk_ttruck_holder_item_owner_id; +drop index ix_ttruck_holder_item_owner_id on ttruck_holder_item; alter table twheel drop foreign key fk_twheel_owner_plate_no; drop index ix_twheel_owner_plate_no on twheel; alter table tire drop foreign key fk_tire_wheel; +alter table tree_entity drop foreign key fk_tree_entity_parent_id; +drop index ix_tree_entity_parent_id on tree_entity; + alter table trip drop foreign key fk_trip_vehicle_driver_id; drop index ix_trip_vehicle_driver_id on trip; @@ -830,6 +893,12 @@ drop table if exists ckey_detail; drop table if exists ckey_parent; +drop table if exists coone; + +drop table if exists coone_many; + +drop table if exists coroot; + drop table if exists calculation_result; drop table if exists cao_bean; @@ -968,6 +1037,8 @@ drop table if exists e_basicenc_bin; drop table if exists e_basicenc_client; +drop table if exists e_basicenc_relate; + drop table if exists e_basic_enum_id; drop table if exists e_basic_eni; @@ -1042,6 +1113,8 @@ drop table if exists efile_no_fk_euser_no_fk_soft_del; drop table if exists egen_props; +drop table if exists eid_uid_bean; + drop table if exists einvoice; drop table if exists e_main; @@ -1116,6 +1189,10 @@ drop table if exists ec_person; drop table if exists ec_person_phone; +drop table if exists ec_top; + +drop table if exists ec_top_ecs_person; + drop table if exists ecbl_person; drop table if exists ecbl_person_phone_numbers; @@ -1136,10 +1213,22 @@ drop table if exists ecs_person; drop table if exists ecs_person_phone; +drop table if exists ecsm_child; + +drop table if exists ecsm_values; + +drop table if exists ecsm_one; + +drop table if exists ecsm_parent; + +drop table if exists ecsm_two; + drop table if exists td_child; drop table if exists td_parent; +drop table if exists element_bean; + drop table if exists empl; drop table if exists esd_detail; @@ -1169,8 +1258,8 @@ drop table if exists he_doc; drop trigger hx_link_history_upd; drop trigger hx_link_history_del; drop view hx_link_with_history; -CALL usp_ebean_drop_column('hx_link', 'sys_period_start'); -CALL usp_ebean_drop_column('hx_link', 'sys_period_end'); +alter table hx_link drop column sys_period_start; +alter table hx_link drop column sys_period_end; drop table hx_link_history; drop table if exists hx_link; @@ -1182,8 +1271,8 @@ drop table if exists hi_doc; drop trigger hi_link_history_upd; drop trigger hi_link_history_del; drop view hi_link_with_history; -CALL usp_ebean_drop_column('hi_link', 'sys_period_start'); -CALL usp_ebean_drop_column('hi_link', 'sys_period_end'); +alter table hi_link drop column sys_period_start; +alter table hi_link drop column sys_period_end; drop table hi_link_history; drop table if exists hi_link; @@ -1191,8 +1280,8 @@ drop table if exists hi_link; drop trigger hi_link_doc_history_upd; drop trigger hi_link_doc_history_del; drop view hi_link_doc_with_history; -CALL usp_ebean_drop_column('hi_link_doc', 'sys_period_start'); -CALL usp_ebean_drop_column('hi_link_doc', 'sys_period_end'); +alter table hi_link_doc drop column sys_period_start; +alter table hi_link_doc drop column sys_period_end; drop table hi_link_doc_history; drop table if exists hi_link_doc; @@ -1200,8 +1289,8 @@ drop table if exists hi_link_doc; drop trigger hi_tone_history_upd; drop trigger hi_tone_history_del; drop view hi_tone_with_history; -CALL usp_ebean_drop_column('hi_tone', 'sys_period_start'); -CALL usp_ebean_drop_column('hi_tone', 'sys_period_end'); +alter table hi_tone drop column sys_period_start; +alter table hi_tone drop column sys_period_end; drop table hi_tone_history; drop table if exists hi_tone; @@ -1209,8 +1298,8 @@ drop table if exists hi_tone; drop trigger hi_tthree_history_upd; drop trigger hi_tthree_history_del; drop view hi_tthree_with_history; -CALL usp_ebean_drop_column('hi_tthree', 'sys_period_start'); -CALL usp_ebean_drop_column('hi_tthree', 'sys_period_end'); +alter table hi_tthree drop column sys_period_start; +alter table hi_tthree drop column sys_period_end; drop table hi_tthree_history; drop table if exists hi_tthree; @@ -1218,8 +1307,8 @@ drop table if exists hi_tthree; drop trigger hi_ttwo_history_upd; drop trigger hi_ttwo_history_del; drop view hi_ttwo_with_history; -CALL usp_ebean_drop_column('hi_ttwo', 'sys_period_start'); -CALL usp_ebean_drop_column('hi_ttwo', 'sys_period_end'); +alter table hi_ttwo drop column sys_period_start; +alter table hi_ttwo drop column sys_period_end; drop table hi_ttwo_history; drop table if exists hi_ttwo; @@ -1227,8 +1316,8 @@ drop table if exists hi_ttwo; drop trigger hsd_setting_history_upd; drop trigger hsd_setting_history_del; drop view hsd_setting_with_history; -CALL usp_ebean_drop_column('hsd_setting', 'sys_period_start'); -CALL usp_ebean_drop_column('hsd_setting', 'sys_period_end'); +alter table hsd_setting drop column sys_period_start; +alter table hsd_setting drop column sys_period_end; drop table hsd_setting_history; drop table if exists hsd_setting; @@ -1236,8 +1325,8 @@ drop table if exists hsd_setting; drop trigger hsd_user_history_upd; drop trigger hsd_user_history_del; drop view hsd_user_with_history; -CALL usp_ebean_drop_column('hsd_user', 'sys_period_start'); -CALL usp_ebean_drop_column('hsd_user', 'sys_period_end'); +alter table hsd_user drop column sys_period_start; +alter table hsd_user drop column sys_period_end; drop table hsd_user_history; drop table if exists hsd_user; @@ -1299,8 +1388,8 @@ drop table if exists level4; drop trigger link_history_upd; drop trigger link_history_del; drop view link_with_history; -CALL usp_ebean_drop_column('link', 'sys_period_start'); -CALL usp_ebean_drop_column('link', 'sys_period_end'); +alter table link drop column sys_period_start; +alter table link drop column sys_period_end; drop table link_history; drop table if exists link; @@ -1411,6 +1500,12 @@ drop table if exists my_lob_size_join_many; drop table if exists noidbean; +drop table if exists o_bean_child; + +drop table if exists ocached_app; + +drop table if exists ocached_app_detail; + drop table if exists o_cached_bean; drop table if exists o_cached_bean_country; @@ -1423,6 +1518,8 @@ drop table if exists o_cached_natkey; drop table if exists o_cached_natkey3; +drop table if exists ocached_nkey_uid; + drop table if exists ocar; drop table if exists ocompany; @@ -1431,8 +1528,16 @@ drop table if exists oengine; drop table if exists ogear_box; +drop table if exists omvertex; + +drop table if exists omvertex_other; + drop table if exists oroad_show_msg; +drop table if exists om_basic_child; + +drop table if exists om_basic_parent; + drop table if exists om_ordered_detail; drop table if exists om_ordered_master; @@ -1535,6 +1640,16 @@ drop table if exists c_participation; drop table if exists password_store_model; +drop table if exists pcf_calendar; + +drop table if exists pcf_city; + +drop table if exists pcf_country; + +drop table if exists pcf_event; + +drop table if exists pcf_person; + drop table if exists mt_permission; drop table if exists persistent_file; @@ -1567,6 +1682,8 @@ drop table if exists rcustomer; drop table if exists r_orders; +drop table if exists referencing_bean; + drop table if exists region; drop table if exists rel_detail; @@ -1581,6 +1698,8 @@ drop table if exists mt_role_permission; drop table if exists em_role; +drop table if exists root_bean; + drop table if exists f_second; drop table if exists section; @@ -1607,6 +1726,8 @@ drop table if exists some_new_types_bean; drop table if exists some_period_bean; +drop table if exists source_base; + drop table if exists stockforecast; drop table if exists sub_section; @@ -1635,11 +1756,11 @@ drop table if exists t_oneb; drop table if exists t_detail_with_other_namexxxyy; -drop table if exists ts_detail_two; - drop table if exists t_atable_thatisrelatively; -drop table if exists ts_master_two; +drop table if exists ttruck_holder; + +drop table if exists ttruck_holder_item; drop table if exists tuuid_entity; @@ -1647,6 +1768,8 @@ drop table if exists twheel; drop table if exists twith_pre_insert; +drop table if exists target_base; + drop table if exists mt_tenant; drop table if exists test_annotation_base_entity; @@ -1655,6 +1778,8 @@ drop table if exists tire; drop table if exists sa_tire; +drop table if exists tree_entity; + drop table if exists trip; drop table if exists truck_ref; @@ -1684,8 +1809,8 @@ drop table if exists oto_user; drop trigger c_user_history_upd; drop trigger c_user_history_del; drop view c_user_with_history; -CALL usp_ebean_drop_column('c_user', 'sys_period_start'); -CALL usp_ebean_drop_column('c_user', 'sys_period_end'); +alter table c_user drop column sys_period_start; +alter table c_user drop column sys_period_end; drop table c_user_history; drop table if exists c_user; @@ -1727,4 +1852,5 @@ drop table if exists zones; drop index ix_contact_last_name_first_name on contact; drop index ix_e_basic_name on e_basic; drop index ix_efile2_no_fk_owner_id on efile2_no_fk; +drop index ix_ecsm_values_host_id on ecsm_values; drop index ix_organization_node_kind on organization_node;