From 4767aff0462ea27bcf747a809491efd82041bb89 Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Tue, 3 Mar 2020 22:03:24 +1300 Subject: [PATCH] Test only update sql server DDL review --- src/test/ddl-review/sqlserver-create-all.sql | 425 +++++++++++++++++-- src/test/ddl-review/sqlserver-drop-all.sql | 181 +++++++- 2 files changed, 561 insertions(+), 45 deletions(-) diff --git a/src/test/ddl-review/sqlserver-create-all.sql b/src/test/ddl-review/sqlserver-create-all.sql index 40f537228..553599674 100644 --- a/src/test/ddl-review/sqlserver-create-all.sql +++ b/src/test/ddl-review/sqlserver-create-all.sql @@ -1,4 +1,4 @@ --- Generated by ebean unknown at 2019-07-25T09:32:20.917Z +-- Generated by ebean unknown at 2020-03-03T08:51:05.196436Z -- init script create procs -- Initial script to create stored procedures etc for sqlserver platform @@ -182,7 +182,7 @@ create table address ( create sequence address_seq as bigint start with 1 increment by 50; create table o_address ( - id smallint not null, + id integer not null, line_1 nvarchar(100), line_2 nvarchar(100), city nvarchar(100), @@ -378,7 +378,7 @@ create table basic_draftable_bean_draft ( when_modified datetime2 not null, constraint pk_basic_draftable_bean_draft primary key (id) ); -create sequence basic_draftable_bean_draft_seq as bigint start with 1 ; +create sequence basic_draftable_bean_draft_seq as bigint start with 1 increment by 50; create table basic_joda_entity ( id numeric(19) not null, @@ -495,6 +495,31 @@ create table ckey_parent ( constraint pk_ckey_parent primary key (one_key,two_key) ); +create table coone ( + id numeric(19) not null, + name nvarchar(255), + constraint pk_coone primary key (id) +); +create sequence coone_seq as bigint start with 1 increment by 50; + +create table coone_many ( + id numeric(19) not null, + coone_id numeric(19) not null, + name nvarchar(255), + deleted integer default 0 not null, + constraint pk_coone_many primary key (id) +); +create sequence coone_many_seq as bigint start with 1 increment by 50; + +create table coroot ( + id numeric(19) not null, + name nvarchar(255), + one_id numeric(19), + constraint pk_coroot primary key (id) +); +create unique nonclustered index uq_coroot_one_id on coroot(one_id) where one_id is not null; +create sequence coroot_seq as bigint start with 1 increment by 50; + create table calculation_result ( id integer not null, charge float(32) not null, @@ -534,6 +559,8 @@ create table sp_car_car_doors ( create table sa_car ( id numeric(19) not null, + brand nvarchar(255), + sold integer not null, version integer not null, constraint pk_sa_car primary key (id) ); @@ -643,6 +670,7 @@ create table contact ( phone nvarchar(255), mobile nvarchar(255), email nvarchar(255), + is_member integer default 0 not null, customer_id integer not null, group_id integer, cretime datetime2 not null, @@ -720,8 +748,8 @@ create table o_customer ( name nvarchar(40) not null, smallnote nvarchar(100), anniversary date, - billing_address_id smallint, - shipping_address_id smallint, + billing_address_id integer, + shipping_address_id integer, cretime datetime2 not null, updtime datetime2 not null, version numeric(19) not null, @@ -752,6 +780,15 @@ create table dexh_entity ( ); create sequence dexh_entity_seq as bigint start with 1 increment by 50; +create table dint_parent ( + type integer not null, + id numeric(19) not null, + val integer, + more nvarchar(255), + constraint pk_dint_parent primary key (id) +); +create sequence dint_parent_seq as bigint start with 1 increment by 50; + create table dmachine ( id numeric(19) not null, name nvarchar(255), @@ -765,7 +802,7 @@ create table d_machine_aux_use ( id numeric(19) not null, machine_id numeric(19) not null, name nvarchar(255), - date date, + edate date, use_secs numeric(19) not null, fuel numeric(28), version numeric(19) not null, @@ -776,7 +813,7 @@ create sequence d_machine_aux_use_seq as bigint start with 1 increment by 50; create table d_machine_stats ( id numeric(19) not null, machine_id numeric(19) not null, - date date, + edate date, total_kms numeric(19) not null, hours numeric(19) not null, rate numeric(28), @@ -789,7 +826,7 @@ create sequence d_machine_stats_seq as bigint start with 1 increment by 50; create table d_machine_use ( id numeric(19) not null, machine_id numeric(19) not null, - date date, + edate date, distance_kms numeric(19) not null, time_secs numeric(19) not null, fuel numeric(28), @@ -954,7 +991,7 @@ create table doc_draft ( when_modified datetime2 not null, constraint pk_doc_draft primary key (id) ); -create sequence doc_draft_seq as bigint start with 1 ; +create sequence doc_draft_seq as bigint start with 1 increment by 50; create table document ( id numeric(19) not null, @@ -981,7 +1018,7 @@ create table document_draft ( constraint pk_document_draft primary key (id) ); create unique nonclustered index uq_document_draft_title on document_draft(title) where title is not null; -create sequence document_draft_seq as bigint start with 1 ; +create sequence document_draft_seq as bigint start with 1 increment by 50; create table document_media ( id numeric(19) not null, @@ -1005,7 +1042,7 @@ create table document_media_draft ( when_modified datetime2 not null, constraint pk_document_media_draft primary key (id) ); -create sequence document_media_draft_seq as bigint start with 1 ; +create sequence document_media_draft_seq as bigint start with 1 increment by 50; create table sp_car_door ( id numeric(19) not null, @@ -1020,7 +1057,7 @@ create table earray_bean ( foo integer, name nvarchar(255), phone_numbers varchar(300), - uids varchar(1000), + uids varchar(1000) not null, other_ids varchar(1000), doubs varchar(1000), statuses varchar(1000), @@ -1131,6 +1168,14 @@ create table e_basicenc_client ( ); create sequence e_basicenc_client_seq as bigint start with 1 increment by 50; +create table e_basicenc_relate ( + id numeric(19) not null, + name nvarchar(255), + other_id integer, + constraint pk_e_basicenc_relate primary key (id) +); +create sequence e_basicenc_relate_seq as bigint start with 1 increment by 50; + create table e_basic_enum_id ( status nvarchar(1) not null, name nvarchar(255), @@ -1347,6 +1392,7 @@ create sequence e_basicver_seq as bigint start with 1 increment by 50; create table e_basic_withlife ( id numeric(19) not null, name nvarchar(255), + other nvarchar(255), deleted integer default 0 not null, version numeric(19) not null, constraint pk_e_basic_withlife primary key (id) @@ -1476,6 +1522,15 @@ create table egen_props ( ); create sequence egen_props_seq as bigint start with 1 increment by 50; +create table eid_uid_bean ( + id numeric(19) not null, + uuid uniqueidentifier not null, + name nvarchar(255), + constraint uq_eid_uid_bean_uuid unique (uuid), + constraint pk_eid_uid_bean primary key (id) +); +create sequence eid_uid_bean_seq as bigint start with 1 increment by 50; + create table einvoice ( id numeric(19) not null, invoice_date datetime2, @@ -1811,6 +1866,21 @@ create table ec_person_phone ( phone nvarchar(255) not null ); +create table ec_top ( + id numeric(19) not null, + name nvarchar(255), + person_id numeric(19), + version numeric(19) not null, + constraint pk_ec_top primary key (id) +); +create sequence ec_top_seq as bigint start with 1 increment by 50; + +create table ec_top_ecs_person ( + ec_top_id numeric(19) not null, + ecs_person_id numeric(19) not null, + constraint pk_ec_top_ecs_person primary key (ec_top_id,ecs_person_id) +); + create table ecbl_person ( id numeric(19) not null, name nvarchar(255), @@ -1823,7 +1893,7 @@ create table ecbl_person_phone_numbers ( person_id numeric(19) not null, country_code nvarchar(2), area nvarchar(6), - number nvarchar(20) + phnum nvarchar(20) ); create table ecbm_person ( @@ -1839,7 +1909,7 @@ create table ecbm_person_phone_numbers ( mkey nvarchar(255) not null, country_code nvarchar(2), area nvarchar(6), - number nvarchar(20) + phnum nvarchar(20) ); create table ecm_person ( @@ -1853,7 +1923,7 @@ create sequence ecm_person_seq as bigint start with 1 increment by 50; create table ecm_person_phone_numbers ( ecm_person_id numeric(19) not null, type nvarchar(4) not null, - number nvarchar(10) not null + phnum nvarchar(10) not null ); create table ecmc_person ( @@ -1883,6 +1953,41 @@ create table ecs_person_phone ( phone nvarchar(255) not null ); +create table ecsm_child ( + one_id uniqueidentifier not null, + ecsm_parent_id numeric(19) not null, + name nvarchar(255), + version numeric(19) not null, + constraint pk_ecsm_child primary key (one_id) +); + +create table ecsm_values ( + host_id uniqueidentifier not null, + value nvarchar(255) not null +); + +create table ecsm_one ( + one_id uniqueidentifier not null, + name nvarchar(255), + version numeric(19) not null, + constraint pk_ecsm_one primary key (one_id) +); + +create table ecsm_parent ( + id numeric(19) not null, + name nvarchar(255), + version numeric(19) not null, + constraint pk_ecsm_parent primary key (id) +); +create sequence ecsm_parent_seq as bigint start with 1 increment by 50; + +create table ecsm_two ( + id uniqueidentifier not null, + name nvarchar(255), + version numeric(19) not null, + constraint pk_ecsm_two primary key (id) +); + create table td_child ( child_id integer not null, child_name nvarchar(255), @@ -1900,6 +2005,14 @@ create table td_parent ( ); create sequence td_parent_seq as bigint start with 1 increment by 50; +create table element_bean ( + id numeric(19) not null, + complex_bean_id uniqueidentifier not null, + value nvarchar(255) not null, + constraint pk_element_bean primary key (id) +); +create sequence element_bean_seq as bigint start with 1 increment by 50; + create table empl ( id numeric(19) not null, name nvarchar(255), @@ -2358,7 +2471,7 @@ create table link_draft ( deleted integer default 0 not null, constraint pk_link_draft primary key (id) ); -create sequence link_draft_seq as bigint start with 1 ; +create sequence link_draft_seq as bigint start with 1 increment by 50; create table la_attr_value ( id integer not null, @@ -2783,6 +2896,32 @@ create table noidbean ( when_created datetime2 not null ); +create table o_bean_child ( + id numeric(19) not null, + cached_bean_id numeric(19), + constraint pk_o_bean_child primary key (id) +); +create sequence o_bean_child_seq as bigint start with 1 increment by 50; + +create table ocached_app ( + id numeric(19) not null, + app_name nvarchar(255), + version numeric(19) not null, + constraint pk_ocached_app primary key (id) +); +create unique nonclustered index uq_ocached_app_app_name on ocached_app(app_name) where app_name is not null; +create sequence ocached_app_seq as bigint start with 1 increment by 50; + +create table ocached_app_detail ( + id numeric(19) not null, + app_id numeric(19) not null, + detail nvarchar(255), + version numeric(19) not null, + constraint pk_ocached_app_detail primary key (id) +); +create unique nonclustered index uq_ocached_app_detail_app_id_detail on ocached_app_detail(app_id,detail) where detail is not null; +create sequence ocached_app_detail_seq as bigint start with 1 increment by 50; + create table o_cached_bean ( id numeric(19) not null, name nvarchar(255), @@ -2832,6 +2971,15 @@ create table o_cached_natkey3 ( ); create sequence o_cached_natkey3_seq as bigint start with 1 increment by 50; +create table ocached_nkey_uid ( + id numeric(19) not null, + cid uniqueidentifier, + other nvarchar(255), + version numeric(19) not null, + constraint pk_ocached_nkey_uid primary key (id) +); +create sequence ocached_nkey_uid_seq as bigint start with 1 increment by 50; + create table ocar ( id integer not null, vin nvarchar(255), @@ -2873,6 +3021,18 @@ create table ogear_box ( ); create unique nonclustered index uq_ogear_box_car_id on ogear_box(car_id) where car_id is not null; +create table omvertex ( + id uniqueidentifier not null, + constraint pk_omvertex primary key (id) +); + +create table omvertex_other ( + id uniqueidentifier not null, + omvertex_id uniqueidentifier not null, + name nvarchar(255), + constraint pk_omvertex_other primary key (id) +); + create table oroad_show_msg ( id integer not null, company_id integer not null, @@ -2884,6 +3044,38 @@ create table oroad_show_msg ( ); create sequence oroad_show_msg_seq as bigint start with 1 increment by 50; +create table om_account_child_dbo ( + id numeric(19) not null, + description nvarchar(255), + banana_rama_id numeric(19), + constraint pk_om_account_child_dbo primary key (id) +); +create sequence om_account_child_dbo_seq as bigint start with 1 increment by 50; + +create table om_account_dbo ( + id numeric(19) not null, + name nvarchar(255), + constraint pk_om_account_dbo primary key (id) +); +create sequence om_account_dbo_seq as bigint start with 1 increment by 50; + +create table om_basic_child ( + id numeric(19) not null, + name nvarchar(255), + parent_id numeric(19), + version numeric(19) not null, + constraint pk_om_basic_child primary key (id) +); +create sequence om_basic_child_seq as bigint start with 1 increment by 50; + +create table om_basic_parent ( + id numeric(19) not null, + name nvarchar(255), + version numeric(19) not null, + constraint pk_om_basic_parent primary key (id) +); +create sequence om_basic_parent_seq as bigint start with 1 increment by 50; + create table om_ordered_detail ( id numeric(19) not null, name nvarchar(255), @@ -3036,6 +3228,7 @@ create table oto_bchild ( child nvarchar(255), constraint pk_oto_bchild primary key (master_id) ); +create sequence oto_bchild_seq as bigint start with 1 increment by 50; create table oto_bmaster ( id numeric(19) not null, @@ -3119,6 +3312,7 @@ create table oto_prime_extra ( version numeric(19) not null, constraint pk_oto_prime_extra primary key (eid) ); +create sequence oto_prime_extra_seq as bigint start with 1 increment by 50; create table oto_sd_child ( id numeric(19) not null, @@ -3340,6 +3534,51 @@ create table password_store_model ( ); create sequence password_store_model_seq as bigint start with 1 increment by 50; +create table pcf_calendar ( + id numeric(19) not null, + pcf_person_id numeric(19) not null, + version numeric(19) not null, + constraint pk_pcf_calendar primary key (id) +); +create sequence pcf_calendar_seq as bigint start with 1 increment by 50; + +create table pcf_city ( + id numeric(19) not null, + pcf_country_id numeric(19) not null, + name nvarchar(255), + mayor_id numeric(19) not null, + vice_mayor_id numeric(19) not null, + version numeric(19) 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 sequence pcf_city_seq as bigint start with 1 increment by 50; + +create table pcf_country ( + id numeric(19) not null, + version numeric(19) not null, + constraint pk_pcf_country primary key (id) +); +create sequence pcf_country_seq as bigint start with 1 increment by 50; + +create table pcf_event ( + id numeric(19) not null, + pcf_calendar_id numeric(19) not null, + name nvarchar(255), + version numeric(19) not null, + constraint pk_pcf_event primary key (id) +); +create sequence pcf_event_seq as bigint start with 1 increment by 50; + +create table pcf_person ( + id numeric(19) not null, + name nvarchar(255), + version numeric(19) not null, + constraint pk_pcf_person primary key (id) +); +create sequence pcf_person_seq as bigint start with 1 increment by 50; + create table mt_permission ( id uniqueidentifier not null, name nvarchar(255), @@ -3469,6 +3708,11 @@ create table r_orders ( constraint pk_r_orders primary key (company,order_number) ); +create table referencing_bean ( + id uniqueidentifier not null, + constraint pk_referencing_bean primary key (id) +); + create table region ( customer integer not null, type integer not null, @@ -3522,6 +3766,14 @@ create table em_role ( ); create sequence em_role_seq as bigint start with 1 increment by 50; +create table root_bean ( + dtype nvarchar(31) not null, + id uniqueidentifier not null, + referencing_bean_id uniqueidentifier not null, + value nvarchar(255), + constraint pk_root_bean primary key (id) +); + create table f_second ( id numeric(19) not null, mod_name nvarchar(255), @@ -3632,6 +3884,7 @@ create table some_new_types_bean ( yr_mth date, month_day date, sql_date date, + sql_time time, local_date date, local_date_time datetime2, offset_date_time datetime2, @@ -3658,6 +3911,15 @@ create table some_period_bean ( ); create sequence some_period_bean_seq as bigint start with 1 increment by 50; +create table source_base ( + dtype nvarchar(31) not null, + id uniqueidentifier not null, + name nvarchar(255), + pos integer not null, + target_id uniqueidentifier, + constraint pk_source_base primary key (id) +); + create table stockforecast ( type nvarchar(31) not null, id numeric(19) not null, @@ -3783,16 +4045,6 @@ create table t_detail_with_other_namexxxyy ( create unique nonclustered index uq_t_detail_with_other_namexxxyy_some_unique_value on t_detail_with_other_namexxxyy(some_unique_value) where some_unique_value is not null; create sequence t_atable_detail_seq as bigint start with 1 increment by 50; -create table ts_detail_two ( - id integer not null, - name nvarchar(255), - description nvarchar(255), - active integer default 0 not null, - master_id integer, - constraint pk_ts_detail_two primary key (id) -); -create sequence ts_detail_two_seq as bigint start with 1 increment by 50; - create table t_atable_thatisrelatively ( id integer not null, name nvarchar(255), @@ -3802,14 +4054,24 @@ create table t_atable_thatisrelatively ( ); create sequence t_atable_master_seq as bigint start with 1 increment by 50; -create table ts_master_two ( - id integer not null, +create table ttruck_holder ( + id numeric(19) not null, name nvarchar(255), - description nvarchar(255), - active integer default 0 not null, - constraint pk_ts_master_two primary key (id) + truck_plate_no nvarchar(32) not null, + basic_id integer, + version numeric(19) not null, + constraint pk_ttruck_holder primary key (id) ); -create sequence ts_master_two_seq as bigint start with 1 increment by 50; +create sequence ttruck_holder_seq as bigint start with 1 increment by 50; + +create table ttruck_holder_item ( + id numeric(19) not null, + some_uid uniqueidentifier, + foo nvarchar(255), + owner_id numeric(19) not null, + constraint pk_ttruck_holder_item primary key (id) +); +create sequence ttruck_holder_item_seq as bigint start with 1 increment by 50; create table tuuid_entity ( id uniqueidentifier not null, @@ -3832,6 +4094,13 @@ create table twith_pre_insert ( ); create sequence twith_pre_insert_seq as bigint start with 1 increment by 50; +create table target_base ( + dtype nvarchar(31) not null, + id uniqueidentifier not null, + name nvarchar(255), + constraint pk_target_base primary key (id) +); + create table mt_tenant ( id uniqueidentifier not null, name nvarchar(255), @@ -3865,11 +4134,19 @@ create table sa_tire ( ); create sequence sa_tire_seq as bigint start with 1 increment by 50; +create table tree_entity ( + id integer not null, + text nvarchar(255), + parent_id integer, + constraint pk_tree_entity primary key (id) +); +create sequence tree_entity_seq as bigint start with 1 increment by 50; + create table trip ( id integer not null, vehicle_driver_id integer, destination nvarchar(255), - address_id smallint, + address_id integer, star_date datetime2, cretime datetime2 not null, updtime datetime2 not null, @@ -3948,7 +4225,7 @@ create table ut_master ( id integer not null, name nvarchar(255), description nvarchar(255), - date date, + event_date date, version integer not null, constraint pk_ut_master primary key (id) ); @@ -4019,6 +4296,13 @@ create table em_user ( ); create sequence em_user_seq as bigint start with 1 increment by 50; +create table user_interest_live ( + user_id numeric(19) not null, + live_id numeric(19) not null, + created_at datetime2 not null, + constraint pk_user_interest_live primary key (user_id,live_id) +); + create table em_user_role ( user_id numeric(19) not null, role_id numeric(19) not null, @@ -4049,7 +4333,7 @@ create table vehicle_driver ( id integer not null, name nvarchar(255), vehicle_id integer, - address_id smallint, + address_id integer, license_issued_on datetime2, cretime datetime2 not null, updtime datetime2 not null, @@ -4157,6 +4441,7 @@ create sequence zones_seq as bigint start with 1 increment by 50; 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); @@ -4232,6 +4517,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); +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); + +alter table coroot add constraint fk_coroot_one_id foreign key (one_id) references coone (id); + 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); @@ -4353,6 +4643,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); +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); + 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); @@ -4429,6 +4722,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); +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); + +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); + +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); + 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); @@ -4444,9 +4746,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); +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); + 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); +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); + 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); @@ -4654,6 +4962,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); +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); + +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); + 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); @@ -4667,8 +4981,17 @@ 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); +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); + alter table oroad_show_msg add constraint fk_oroad_show_msg_company_id foreign key (company_id) references ocompany (id); +create index ix_om_account_child_dbo_banana_rama_id on om_account_child_dbo (banana_rama_id); +alter table om_account_child_dbo add constraint fk_om_account_child_dbo_banana_rama_id foreign key (banana_rama_id) references om_account_dbo (id); + +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); + 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); @@ -4749,6 +5072,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); +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); + +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); + +alter table pcf_city add constraint fk_pcf_city_mayor_id foreign key (mayor_id) references pcf_person (id); + +alter table pcf_city add constraint fk_pcf_city_vice_mayor_id foreign key (vice_mayor_id) references pcf_person (id); + +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); + alter table persistent_file_content add constraint fk_persistent_file_content_persistent_file_id foreign key (persistent_file_id) references persistent_file (id); create index ix_person_default_address_oid on person (default_address_oid); @@ -4790,6 +5126,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); +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); + alter table f_second add constraint fk_f_second_first foreign key (first) references f_first (id); create index ix_section_article_id on section (article_id); @@ -4813,6 +5152,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); +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); + 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); @@ -4827,14 +5169,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); -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); +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); + +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); + +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); 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); alter table tire add constraint fk_tire_wheel foreign key (wheel) references wheel (id); +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); + 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); diff --git a/src/test/ddl-review/sqlserver-drop-all.sql b/src/test/ddl-review/sqlserver-drop-all.sql index 7b1853e27..7abdc1cc9 100644 --- a/src/test/ddl-review/sqlserver-drop-all.sql +++ b/src/test/ddl-review/sqlserver-drop-all.sql @@ -1,4 +1,4 @@ --- Generated by ebean unknown at 2019-07-25T09:32:20.917Z +-- Generated by ebean unknown at 2020-03-03T08:51:05.196436Z IF OBJECT_ID('fk_bar_foo_id', 'F') IS NOT NULL alter table bar drop constraint fk_bar_foo_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('bar','U') AND name = 'ix_bar_foo_id') drop index ix_bar_foo_id ON bar; @@ -78,6 +78,12 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ckey_detail IF OBJECT_ID('fk_ckey_parent_assoc_id', 'F') IS NOT NULL alter table ckey_parent drop constraint fk_ckey_parent_assoc_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ckey_parent','U') AND name = 'ix_ckey_parent_assoc_id') drop index ix_ckey_parent_assoc_id ON ckey_parent; +IF OBJECT_ID('fk_coone_many_coone_id', 'F') IS NOT NULL alter table coone_many drop constraint fk_coone_many_coone_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('coone_many','U') AND name = 'ix_coone_many_coone_id') drop index ix_coone_many_coone_id ON coone_many; + +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('coroot','U') AND name = 'uq_coroot_one_id') drop index uq_coroot_one_id ON coroot; +IF OBJECT_ID('fk_coroot_one_id', 'F') IS NOT NULL alter table coroot drop constraint fk_coroot_one_id; + IF OBJECT_ID('fk_calculation_result_product_configuration_id', 'F') IS NOT NULL alter table calculation_result drop constraint fk_calculation_result_product_configuration_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('calculation_result','U') AND name = 'ix_calculation_result_product_configuration_id') drop index ix_calculation_result_product_configuration_id ON calculation_result; @@ -202,6 +208,9 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('document_me IF OBJECT_ID('fk_document_media_draft_document_id', 'F') IS NOT NULL alter table document_media_draft drop constraint fk_document_media_draft_document_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('document_media_draft','U') AND name = 'ix_document_media_draft_document_id') drop index ix_document_media_draft_document_id ON document_media_draft; +IF OBJECT_ID('fk_e_basicenc_relate_other_id', 'F') IS NOT NULL alter table e_basicenc_relate drop constraint fk_e_basicenc_relate_other_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('e_basicenc_relate','U') AND name = 'ix_e_basicenc_relate_other_id') drop index ix_e_basicenc_relate_other_id ON e_basicenc_relate; + IF OBJECT_ID('fk_ebasic_json_map_detail_owner_id', 'F') IS NOT NULL alter table ebasic_json_map_detail drop constraint fk_ebasic_json_map_detail_owner_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ebasic_json_map_detail','U') AND name = 'ix_ebasic_json_map_detail_owner_id') drop index ix_ebasic_json_map_detail_owner_id ON ebasic_json_map_detail; @@ -283,6 +292,15 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ec_enum_per IF OBJECT_ID('fk_ec_person_phone_owner_id', 'F') IS NOT NULL alter table ec_person_phone drop constraint fk_ec_person_phone_owner_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ec_person_phone','U') AND name = 'ix_ec_person_phone_owner_id') drop index ix_ec_person_phone_owner_id ON ec_person_phone; +IF OBJECT_ID('fk_ec_top_person_id', 'F') IS NOT NULL alter table ec_top drop constraint fk_ec_top_person_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ec_top','U') AND name = 'ix_ec_top_person_id') drop index ix_ec_top_person_id ON ec_top; + +IF OBJECT_ID('fk_ec_top_ecs_person_ec_top', 'F') IS NOT NULL alter table ec_top_ecs_person drop constraint fk_ec_top_ecs_person_ec_top; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ec_top_ecs_person','U') AND name = 'ix_ec_top_ecs_person_ec_top') drop index ix_ec_top_ecs_person_ec_top ON ec_top_ecs_person; + +IF OBJECT_ID('fk_ec_top_ecs_person_ecs_person', 'F') IS NOT NULL alter table ec_top_ecs_person drop constraint fk_ec_top_ecs_person_ecs_person; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ec_top_ecs_person','U') AND name = 'ix_ec_top_ecs_person_ecs_person') drop index ix_ec_top_ecs_person_ecs_person ON ec_top_ecs_person; + IF OBJECT_ID('fk_ecbl_person_phone_numbers_person_id', 'F') IS NOT NULL alter table ecbl_person_phone_numbers drop constraint fk_ecbl_person_phone_numbers_person_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ecbl_person_phone_numbers','U') AND name = 'ix_ecbl_person_phone_numbers_person_id') drop index ix_ecbl_person_phone_numbers_person_id ON ecbl_person_phone_numbers; @@ -298,9 +316,15 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ecmc_person IF OBJECT_ID('fk_ecs_person_phone_ecs_person_id', 'F') IS NOT NULL alter table ecs_person_phone drop constraint fk_ecs_person_phone_ecs_person_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ecs_person_phone','U') AND name = 'ix_ecs_person_phone_ecs_person_id') drop index ix_ecs_person_phone_ecs_person_id ON ecs_person_phone; +IF OBJECT_ID('fk_ecsm_child_ecsm_parent_id', 'F') IS NOT NULL alter table ecsm_child drop constraint fk_ecsm_child_ecsm_parent_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ecsm_child','U') AND name = 'ix_ecsm_child_ecsm_parent_id') drop index ix_ecsm_child_ecsm_parent_id ON ecsm_child; + IF OBJECT_ID('fk_td_child_parent_id', 'F') IS NOT NULL alter table td_child drop constraint fk_td_child_parent_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('td_child','U') AND name = 'ix_td_child_parent_id') drop index ix_td_child_parent_id ON td_child; +IF OBJECT_ID('fk_element_bean_complex_bean_id', 'F') IS NOT NULL alter table element_bean drop constraint fk_element_bean_complex_bean_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('element_bean','U') AND name = 'ix_element_bean_complex_bean_id') drop index ix_element_bean_complex_bean_id ON element_bean; + IF OBJECT_ID('fk_empl_default_address_id', 'F') IS NOT NULL alter table empl drop constraint fk_empl_default_address_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('empl','U') AND name = 'ix_empl_default_address_id') drop index ix_empl_default_address_id ON empl; @@ -517,6 +541,14 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ms_many_b_m IF OBJECT_ID('fk_my_lob_size_join_many_parent_id', 'F') IS NOT NULL alter table my_lob_size_join_many drop constraint fk_my_lob_size_join_many_parent_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('my_lob_size_join_many','U') AND name = 'ix_my_lob_size_join_many_parent_id') drop index ix_my_lob_size_join_many_parent_id ON my_lob_size_join_many; +IF OBJECT_ID('fk_o_bean_child_cached_bean_id', 'F') IS NOT NULL alter table o_bean_child drop constraint fk_o_bean_child_cached_bean_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('o_bean_child','U') AND name = 'ix_o_bean_child_cached_bean_id') drop index ix_o_bean_child_cached_bean_id ON o_bean_child; + +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ocached_app','U') AND name = 'uq_ocached_app_app_name') drop index uq_ocached_app_app_name ON ocached_app; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ocached_app_detail','U') AND name = 'uq_ocached_app_detail_app_id_detail') drop index uq_ocached_app_detail_app_id_detail ON ocached_app_detail; +IF OBJECT_ID('fk_ocached_app_detail_app_id', 'F') IS NOT NULL alter table ocached_app_detail drop constraint fk_ocached_app_detail_app_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ocached_app_detail','U') AND name = 'ix_ocached_app_detail_app_id') drop index ix_ocached_app_detail_app_id ON ocached_app_detail; + IF OBJECT_ID('fk_o_cached_bean_country_o_cached_bean', 'F') IS NOT NULL alter table o_cached_bean_country drop constraint fk_o_cached_bean_country_o_cached_bean; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('o_cached_bean_country','U') AND name = 'ix_o_cached_bean_country_o_cached_bean') drop index ix_o_cached_bean_country_o_cached_bean ON o_cached_bean_country; @@ -533,8 +565,17 @@ IF OBJECT_ID('fk_oengine_car_id', 'F') IS NOT NULL alter table oengine drop cons IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ogear_box','U') AND name = 'uq_ogear_box_car_id') drop index uq_ogear_box_car_id ON ogear_box; IF OBJECT_ID('fk_ogear_box_car_id', 'F') IS NOT NULL alter table ogear_box drop constraint fk_ogear_box_car_id; +IF OBJECT_ID('fk_omvertex_other_omvertex_id', 'F') IS NOT NULL alter table omvertex_other drop constraint fk_omvertex_other_omvertex_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('omvertex_other','U') AND name = 'ix_omvertex_other_omvertex_id') drop index ix_omvertex_other_omvertex_id ON omvertex_other; + IF OBJECT_ID('fk_oroad_show_msg_company_id', 'F') IS NOT NULL alter table oroad_show_msg drop constraint fk_oroad_show_msg_company_id; +IF OBJECT_ID('fk_om_account_child_dbo_banana_rama_id', 'F') IS NOT NULL alter table om_account_child_dbo drop constraint fk_om_account_child_dbo_banana_rama_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('om_account_child_dbo','U') AND name = 'ix_om_account_child_dbo_banana_rama_id') drop index ix_om_account_child_dbo_banana_rama_id ON om_account_child_dbo; + +IF OBJECT_ID('fk_om_basic_child_parent_id', 'F') IS NOT NULL alter table om_basic_child drop constraint fk_om_basic_child_parent_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('om_basic_child','U') AND name = 'ix_om_basic_child_parent_id') drop index ix_om_basic_child_parent_id ON om_basic_child; + IF OBJECT_ID('fk_om_ordered_detail_master_id', 'F') IS NOT NULL alter table om_ordered_detail drop constraint fk_om_ordered_detail_master_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('om_ordered_detail','U') AND name = 'ix_om_ordered_detail_master_id') drop index ix_om_ordered_detail_master_id ON om_ordered_detail; @@ -627,6 +668,19 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('c_participa IF OBJECT_ID('fk_c_participation_user_id', 'F') IS NOT NULL alter table c_participation drop constraint fk_c_participation_user_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('c_participation','U') AND name = 'ix_c_participation_user_id') drop index ix_c_participation_user_id ON c_participation; +IF OBJECT_ID('fk_pcf_calendar_pcf_person_id', 'F') IS NOT NULL alter table pcf_calendar drop constraint fk_pcf_calendar_pcf_person_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('pcf_calendar','U') AND name = 'ix_pcf_calendar_pcf_person_id') drop index ix_pcf_calendar_pcf_person_id ON pcf_calendar; + +IF OBJECT_ID('fk_pcf_city_pcf_country_id', 'F') IS NOT NULL alter table pcf_city drop constraint fk_pcf_city_pcf_country_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('pcf_city','U') AND name = 'ix_pcf_city_pcf_country_id') drop index ix_pcf_city_pcf_country_id ON pcf_city; + +IF OBJECT_ID('fk_pcf_city_mayor_id', 'F') IS NOT NULL alter table pcf_city drop constraint fk_pcf_city_mayor_id; + +IF OBJECT_ID('fk_pcf_city_vice_mayor_id', 'F') IS NOT NULL alter table pcf_city drop constraint fk_pcf_city_vice_mayor_id; + +IF OBJECT_ID('fk_pcf_event_pcf_calendar_id', 'F') IS NOT NULL alter table pcf_event drop constraint fk_pcf_event_pcf_calendar_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('pcf_event','U') AND name = 'ix_pcf_event_pcf_calendar_id') drop index ix_pcf_event_pcf_calendar_id ON pcf_event; + IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('persistent_file_content','U') AND name = 'uq_persistent_file_content_persistent_file_id') drop index uq_persistent_file_content_persistent_file_id ON persistent_file_content; IF OBJECT_ID('fk_persistent_file_content_persistent_file_id', 'F') IS NOT NULL alter table persistent_file_content drop constraint fk_persistent_file_content_persistent_file_id; @@ -669,6 +723,9 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('mt_role_per IF OBJECT_ID('fk_mt_role_permission_mt_permission', 'F') IS NOT NULL alter table mt_role_permission drop constraint fk_mt_role_permission_mt_permission; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('mt_role_permission','U') AND name = 'ix_mt_role_permission_mt_permission') drop index ix_mt_role_permission_mt_permission ON mt_role_permission; +IF OBJECT_ID('fk_root_bean_referencing_bean_id', 'F') IS NOT NULL alter table root_bean drop constraint fk_root_bean_referencing_bean_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('root_bean','U') AND name = 'ix_root_bean_referencing_bean_id') drop index ix_root_bean_referencing_bean_id ON root_bean; + IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('f_second','U') AND name = 'uq_f_second_first') drop index uq_f_second_first ON f_second; IF OBJECT_ID('fk_f_second_first', 'F') IS NOT NULL alter table f_second drop constraint fk_f_second_first; @@ -696,6 +753,9 @@ IF OBJECT_ID('fk_site_data_container_id', 'F') IS NOT NULL alter table site drop IF OBJECT_ID('fk_site_site_address_id', 'F') IS NOT NULL alter table site drop constraint fk_site_site_address_id; +IF OBJECT_ID('fk_source_base_target_id', 'F') IS NOT NULL alter table source_base drop constraint fk_source_base_target_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('source_base','U') AND name = 'ix_source_base_target_id') drop index ix_source_base_target_id ON source_base; + IF OBJECT_ID('fk_stockforecast_inner_report_id', 'F') IS NOT NULL alter table stockforecast drop constraint fk_stockforecast_inner_report_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('stockforecast','U') AND name = 'ix_stockforecast_inner_report_id') drop index ix_stockforecast_inner_report_id ON stockforecast; @@ -712,8 +772,14 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('t_detail_wi IF OBJECT_ID('fk_t_detail_with_other_namexxxyy_master_id', 'F') IS NOT NULL alter table t_detail_with_other_namexxxyy drop constraint fk_t_detail_with_other_namexxxyy_master_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('t_detail_with_other_namexxxyy','U') AND name = 'ix_t_detail_with_other_namexxxyy_master_id') drop index ix_t_detail_with_other_namexxxyy_master_id ON t_detail_with_other_namexxxyy; -IF OBJECT_ID('fk_ts_detail_two_master_id', 'F') IS NOT NULL alter table ts_detail_two drop constraint fk_ts_detail_two_master_id; -IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ts_detail_two','U') AND name = 'ix_ts_detail_two_master_id') drop index ix_ts_detail_two_master_id ON ts_detail_two; +IF OBJECT_ID('fk_ttruck_holder_truck_plate_no', 'F') IS NOT NULL alter table ttruck_holder drop constraint fk_ttruck_holder_truck_plate_no; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ttruck_holder','U') AND name = 'ix_ttruck_holder_truck_plate_no') drop index ix_ttruck_holder_truck_plate_no ON ttruck_holder; + +IF OBJECT_ID('fk_ttruck_holder_basic_id', 'F') IS NOT NULL alter table ttruck_holder drop constraint fk_ttruck_holder_basic_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ttruck_holder','U') AND name = 'ix_ttruck_holder_basic_id') drop index ix_ttruck_holder_basic_id ON ttruck_holder; + +IF OBJECT_ID('fk_ttruck_holder_item_owner_id', 'F') IS NOT NULL alter table ttruck_holder_item drop constraint fk_ttruck_holder_item_owner_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ttruck_holder_item','U') AND name = 'ix_ttruck_holder_item_owner_id') drop index ix_ttruck_holder_item_owner_id ON ttruck_holder_item; IF OBJECT_ID('fk_twheel_owner_plate_no', 'F') IS NOT NULL alter table twheel drop constraint fk_twheel_owner_plate_no; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('twheel','U') AND name = 'ix_twheel_owner_plate_no') drop index ix_twheel_owner_plate_no ON twheel; @@ -721,6 +787,9 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('twheel','U' IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('tire','U') AND name = 'uq_tire_wheel') drop index uq_tire_wheel ON tire; IF OBJECT_ID('fk_tire_wheel', 'F') IS NOT NULL alter table tire drop constraint fk_tire_wheel; +IF OBJECT_ID('fk_tree_entity_parent_id', 'F') IS NOT NULL alter table tree_entity drop constraint fk_tree_entity_parent_id; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('tree_entity','U') AND name = 'ix_tree_entity_parent_id') drop index ix_tree_entity_parent_id ON tree_entity; + IF OBJECT_ID('fk_trip_vehicle_driver_id', 'F') IS NOT NULL alter table trip drop constraint fk_trip_vehicle_driver_id; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('trip','U') AND name = 'ix_trip_vehicle_driver_id') drop index ix_trip_vehicle_driver_id ON trip; @@ -916,6 +985,15 @@ IF OBJECT_ID('ckey_detail_seq', 'SO') IS NOT NULL drop sequence ckey_detail_seq; IF OBJECT_ID('ckey_parent', 'U') IS NOT NULL drop table ckey_parent; +IF OBJECT_ID('coone', 'U') IS NOT NULL drop table coone; +IF OBJECT_ID('coone_seq', 'SO') IS NOT NULL drop sequence coone_seq; + +IF OBJECT_ID('coone_many', 'U') IS NOT NULL drop table coone_many; +IF OBJECT_ID('coone_many_seq', 'SO') IS NOT NULL drop sequence coone_many_seq; + +IF OBJECT_ID('coroot', 'U') IS NOT NULL drop table coroot; +IF OBJECT_ID('coroot_seq', 'SO') IS NOT NULL drop sequence coroot_seq; + IF OBJECT_ID('calculation_result', 'U') IS NOT NULL drop table calculation_result; IF OBJECT_ID('calculation_result_seq', 'SO') IS NOT NULL drop sequence calculation_result_seq; @@ -995,6 +1073,9 @@ IF OBJECT_ID('dcredit_drol', 'U') IS NOT NULL drop table dcredit_drol; IF OBJECT_ID('dexh_entity', 'U') IS NOT NULL drop table dexh_entity; IF OBJECT_ID('dexh_entity_seq', 'SO') IS NOT NULL drop sequence dexh_entity_seq; +IF OBJECT_ID('dint_parent', 'U') IS NOT NULL drop table dint_parent; +IF OBJECT_ID('dint_parent_seq', 'SO') IS NOT NULL drop sequence dint_parent_seq; + IF OBJECT_ID('dmachine', 'U') IS NOT NULL drop table dmachine; IF OBJECT_ID('dmachine_seq', 'SO') IS NOT NULL drop sequence dmachine_seq; @@ -1110,6 +1191,9 @@ IF OBJECT_ID('e_basicenc_bin_seq', 'SO') IS NOT NULL drop sequence e_basicenc_bi IF OBJECT_ID('e_basicenc_client', 'U') IS NOT NULL drop table e_basicenc_client; IF OBJECT_ID('e_basicenc_client_seq', 'SO') IS NOT NULL drop sequence e_basicenc_client_seq; +IF OBJECT_ID('e_basicenc_relate', 'U') IS NOT NULL drop table e_basicenc_relate; +IF OBJECT_ID('e_basicenc_relate_seq', 'SO') IS NOT NULL drop sequence e_basicenc_relate_seq; + IF OBJECT_ID('e_basic_enum_id', 'U') IS NOT NULL drop table e_basic_enum_id; IF OBJECT_ID('e_basic_eni', 'U') IS NOT NULL drop table e_basic_eni; @@ -1213,6 +1297,9 @@ IF OBJECT_ID('efile_no_fk_euser_no_fk_soft_del', 'U') IS NOT NULL drop table efi IF OBJECT_ID('egen_props', 'U') IS NOT NULL drop table egen_props; IF OBJECT_ID('egen_props_seq', 'SO') IS NOT NULL drop sequence egen_props_seq; +IF OBJECT_ID('eid_uid_bean', 'U') IS NOT NULL drop table eid_uid_bean; +IF OBJECT_ID('eid_uid_bean_seq', 'SO') IS NOT NULL drop sequence eid_uid_bean_seq; + IF OBJECT_ID('einvoice', 'U') IS NOT NULL drop table einvoice; IF OBJECT_ID('einvoice_seq', 'SO') IS NOT NULL drop sequence einvoice_seq; @@ -1318,6 +1405,11 @@ IF OBJECT_ID('ec_person_seq', 'SO') IS NOT NULL drop sequence ec_person_seq; IF OBJECT_ID('ec_person_phone', 'U') IS NOT NULL drop table ec_person_phone; +IF OBJECT_ID('ec_top', 'U') IS NOT NULL drop table ec_top; +IF OBJECT_ID('ec_top_seq', 'SO') IS NOT NULL drop sequence ec_top_seq; + +IF OBJECT_ID('ec_top_ecs_person', 'U') IS NOT NULL drop table ec_top_ecs_person; + IF OBJECT_ID('ecbl_person', 'U') IS NOT NULL drop table ecbl_person; IF OBJECT_ID('ecbl_person_seq', 'SO') IS NOT NULL drop sequence ecbl_person_seq; @@ -1343,12 +1435,26 @@ IF OBJECT_ID('ecs_person_seq', 'SO') IS NOT NULL drop sequence ecs_person_seq; IF OBJECT_ID('ecs_person_phone', 'U') IS NOT NULL drop table ecs_person_phone; +IF OBJECT_ID('ecsm_child', 'U') IS NOT NULL drop table ecsm_child; + +IF OBJECT_ID('ecsm_values', 'U') IS NOT NULL drop table ecsm_values; + +IF OBJECT_ID('ecsm_one', 'U') IS NOT NULL drop table ecsm_one; + +IF OBJECT_ID('ecsm_parent', 'U') IS NOT NULL drop table ecsm_parent; +IF OBJECT_ID('ecsm_parent_seq', 'SO') IS NOT NULL drop sequence ecsm_parent_seq; + +IF OBJECT_ID('ecsm_two', 'U') IS NOT NULL drop table ecsm_two; + IF OBJECT_ID('td_child', 'U') IS NOT NULL drop table td_child; IF OBJECT_ID('td_child_seq', 'SO') IS NOT NULL drop sequence td_child_seq; IF OBJECT_ID('td_parent', 'U') IS NOT NULL drop table td_parent; IF OBJECT_ID('td_parent_seq', 'SO') IS NOT NULL drop sequence td_parent_seq; +IF OBJECT_ID('element_bean', 'U') IS NOT NULL drop table element_bean; +IF OBJECT_ID('element_bean_seq', 'SO') IS NOT NULL drop sequence element_bean_seq; + IF OBJECT_ID('empl', 'U') IS NOT NULL drop table empl; IF OBJECT_ID('empl_seq', 'SO') IS NOT NULL drop sequence empl_seq; @@ -1646,6 +1752,15 @@ IF OBJECT_ID('my_lob_size_join_many_seq', 'SO') IS NOT NULL drop sequence my_lob IF OBJECT_ID('noidbean', 'U') IS NOT NULL drop table noidbean; +IF OBJECT_ID('o_bean_child', 'U') IS NOT NULL drop table o_bean_child; +IF OBJECT_ID('o_bean_child_seq', 'SO') IS NOT NULL drop sequence o_bean_child_seq; + +IF OBJECT_ID('ocached_app', 'U') IS NOT NULL drop table ocached_app; +IF OBJECT_ID('ocached_app_seq', 'SO') IS NOT NULL drop sequence ocached_app_seq; + +IF OBJECT_ID('ocached_app_detail', 'U') IS NOT NULL drop table ocached_app_detail; +IF OBJECT_ID('ocached_app_detail_seq', 'SO') IS NOT NULL drop sequence ocached_app_detail_seq; + IF OBJECT_ID('o_cached_bean', 'U') IS NOT NULL drop table o_cached_bean; IF OBJECT_ID('o_cached_bean_seq', 'SO') IS NOT NULL drop sequence o_cached_bean_seq; @@ -1663,6 +1778,9 @@ IF OBJECT_ID('o_cached_natkey_seq', 'SO') IS NOT NULL drop sequence o_cached_nat IF OBJECT_ID('o_cached_natkey3', 'U') IS NOT NULL drop table o_cached_natkey3; IF OBJECT_ID('o_cached_natkey3_seq', 'SO') IS NOT NULL drop sequence o_cached_natkey3_seq; +IF OBJECT_ID('ocached_nkey_uid', 'U') IS NOT NULL drop table ocached_nkey_uid; +IF OBJECT_ID('ocached_nkey_uid_seq', 'SO') IS NOT NULL drop sequence ocached_nkey_uid_seq; + IF OBJECT_ID('ocar', 'U') IS NOT NULL drop table ocar; IF OBJECT_ID('ocar_seq', 'SO') IS NOT NULL drop sequence ocar_seq; @@ -1673,9 +1791,25 @@ IF OBJECT_ID('oengine', 'U') IS NOT NULL drop table oengine; IF OBJECT_ID('ogear_box', 'U') IS NOT NULL drop table ogear_box; +IF OBJECT_ID('omvertex', 'U') IS NOT NULL drop table omvertex; + +IF OBJECT_ID('omvertex_other', 'U') IS NOT NULL drop table omvertex_other; + IF OBJECT_ID('oroad_show_msg', 'U') IS NOT NULL drop table oroad_show_msg; IF OBJECT_ID('oroad_show_msg_seq', 'SO') IS NOT NULL drop sequence oroad_show_msg_seq; +IF OBJECT_ID('om_account_child_dbo', 'U') IS NOT NULL drop table om_account_child_dbo; +IF OBJECT_ID('om_account_child_dbo_seq', 'SO') IS NOT NULL drop sequence om_account_child_dbo_seq; + +IF OBJECT_ID('om_account_dbo', 'U') IS NOT NULL drop table om_account_dbo; +IF OBJECT_ID('om_account_dbo_seq', 'SO') IS NOT NULL drop sequence om_account_dbo_seq; + +IF OBJECT_ID('om_basic_child', 'U') IS NOT NULL drop table om_basic_child; +IF OBJECT_ID('om_basic_child_seq', 'SO') IS NOT NULL drop sequence om_basic_child_seq; + +IF OBJECT_ID('om_basic_parent', 'U') IS NOT NULL drop table om_basic_parent; +IF OBJECT_ID('om_basic_parent_seq', 'SO') IS NOT NULL drop sequence om_basic_parent_seq; + IF OBJECT_ID('om_ordered_detail', 'U') IS NOT NULL drop table om_ordered_detail; IF OBJECT_ID('om_ordered_detail_seq', 'SO') IS NOT NULL drop sequence om_ordered_detail_seq; @@ -1720,6 +1854,7 @@ IF OBJECT_ID('oto_aone', 'U') IS NOT NULL drop table oto_aone; IF OBJECT_ID('oto_atwo', 'U') IS NOT NULL drop table oto_atwo; IF OBJECT_ID('oto_bchild', 'U') IS NOT NULL drop table oto_bchild; +IF OBJECT_ID('oto_bchild_seq', 'SO') IS NOT NULL drop sequence oto_bchild_seq; IF OBJECT_ID('oto_bmaster', 'U') IS NOT NULL drop table oto_bmaster; IF OBJECT_ID('oto_bmaster_seq', 'SO') IS NOT NULL drop sequence oto_bmaster_seq; @@ -1749,6 +1884,7 @@ IF OBJECT_ID('oto_prime', 'U') IS NOT NULL drop table oto_prime; IF OBJECT_ID('oto_prime_seq', 'SO') IS NOT NULL drop sequence oto_prime_seq; IF OBJECT_ID('oto_prime_extra', 'U') IS NOT NULL drop table oto_prime_extra; +IF OBJECT_ID('oto_prime_extra_seq', 'SO') IS NOT NULL drop sequence oto_prime_extra_seq; IF OBJECT_ID('oto_sd_child', 'U') IS NOT NULL drop table oto_sd_child; IF OBJECT_ID('oto_sd_child_seq', 'SO') IS NOT NULL drop sequence oto_sd_child_seq; @@ -1813,6 +1949,21 @@ IF OBJECT_ID('c_participation_seq', 'SO') IS NOT NULL drop sequence c_participat IF OBJECT_ID('password_store_model', 'U') IS NOT NULL drop table password_store_model; IF OBJECT_ID('password_store_model_seq', 'SO') IS NOT NULL drop sequence password_store_model_seq; +IF OBJECT_ID('pcf_calendar', 'U') IS NOT NULL drop table pcf_calendar; +IF OBJECT_ID('pcf_calendar_seq', 'SO') IS NOT NULL drop sequence pcf_calendar_seq; + +IF OBJECT_ID('pcf_city', 'U') IS NOT NULL drop table pcf_city; +IF OBJECT_ID('pcf_city_seq', 'SO') IS NOT NULL drop sequence pcf_city_seq; + +IF OBJECT_ID('pcf_country', 'U') IS NOT NULL drop table pcf_country; +IF OBJECT_ID('pcf_country_seq', 'SO') IS NOT NULL drop sequence pcf_country_seq; + +IF OBJECT_ID('pcf_event', 'U') IS NOT NULL drop table pcf_event; +IF OBJECT_ID('pcf_event_seq', 'SO') IS NOT NULL drop sequence pcf_event_seq; + +IF OBJECT_ID('pcf_person', 'U') IS NOT NULL drop table pcf_person; +IF OBJECT_ID('pcf_person_seq', 'SO') IS NOT NULL drop sequence pcf_person_seq; + IF OBJECT_ID('mt_permission', 'U') IS NOT NULL drop table mt_permission; IF OBJECT_ID('persistent_file', 'U') IS NOT NULL drop table persistent_file; @@ -1853,6 +2004,8 @@ IF OBJECT_ID('rcustomer', 'U') IS NOT NULL drop table rcustomer; IF OBJECT_ID('r_orders', 'U') IS NOT NULL drop table r_orders; +IF OBJECT_ID('referencing_bean', 'U') IS NOT NULL drop table referencing_bean; + IF OBJECT_ID('region', 'U') IS NOT NULL drop table region; IF OBJECT_ID('rel_detail', 'U') IS NOT NULL drop table rel_detail; @@ -1870,6 +2023,8 @@ IF OBJECT_ID('mt_role_permission', 'U') IS NOT NULL drop table mt_role_permissio IF OBJECT_ID('em_role', 'U') IS NOT NULL drop table em_role; IF OBJECT_ID('em_role_seq', 'SO') IS NOT NULL drop sequence em_role_seq; +IF OBJECT_ID('root_bean', 'U') IS NOT NULL drop table root_bean; + IF OBJECT_ID('f_second', 'U') IS NOT NULL drop table f_second; IF OBJECT_ID('f_second_seq', 'SO') IS NOT NULL drop sequence f_second_seq; @@ -1907,6 +2062,8 @@ IF OBJECT_ID('some_new_types_bean_seq', 'SO') IS NOT NULL drop sequence some_new IF OBJECT_ID('some_period_bean', 'U') IS NOT NULL drop table some_period_bean; IF OBJECT_ID('some_period_bean_seq', 'SO') IS NOT NULL drop sequence some_period_bean_seq; +IF OBJECT_ID('source_base', 'U') IS NOT NULL drop table source_base; + IF OBJECT_ID('stockforecast', 'U') IS NOT NULL drop table stockforecast; IF OBJECT_ID('stockforecast_seq', 'SO') IS NOT NULL drop sequence stockforecast_seq; @@ -1948,14 +2105,14 @@ IF OBJECT_ID('t_oneb_seq', 'SO') IS NOT NULL drop sequence t_oneb_seq; IF OBJECT_ID('t_detail_with_other_namexxxyy', 'U') IS NOT NULL drop table t_detail_with_other_namexxxyy; IF OBJECT_ID('t_atable_detail_seq', 'SO') IS NOT NULL drop sequence t_atable_detail_seq; -IF OBJECT_ID('ts_detail_two', 'U') IS NOT NULL drop table ts_detail_two; -IF OBJECT_ID('ts_detail_two_seq', 'SO') IS NOT NULL drop sequence ts_detail_two_seq; - IF OBJECT_ID('t_atable_thatisrelatively', 'U') IS NOT NULL drop table t_atable_thatisrelatively; IF OBJECT_ID('t_atable_master_seq', 'SO') IS NOT NULL drop sequence t_atable_master_seq; -IF OBJECT_ID('ts_master_two', 'U') IS NOT NULL drop table ts_master_two; -IF OBJECT_ID('ts_master_two_seq', 'SO') IS NOT NULL drop sequence ts_master_two_seq; +IF OBJECT_ID('ttruck_holder', 'U') IS NOT NULL drop table ttruck_holder; +IF OBJECT_ID('ttruck_holder_seq', 'SO') IS NOT NULL drop sequence ttruck_holder_seq; + +IF OBJECT_ID('ttruck_holder_item', 'U') IS NOT NULL drop table ttruck_holder_item; +IF OBJECT_ID('ttruck_holder_item_seq', 'SO') IS NOT NULL drop sequence ttruck_holder_item_seq; IF OBJECT_ID('tuuid_entity', 'U') IS NOT NULL drop table tuuid_entity; @@ -1965,6 +2122,8 @@ IF OBJECT_ID('twheel_seq', 'SO') IS NOT NULL drop sequence twheel_seq; IF OBJECT_ID('twith_pre_insert', 'U') IS NOT NULL drop table twith_pre_insert; IF OBJECT_ID('twith_pre_insert_seq', 'SO') IS NOT NULL drop sequence twith_pre_insert_seq; +IF OBJECT_ID('target_base', 'U') IS NOT NULL drop table target_base; + IF OBJECT_ID('mt_tenant', 'U') IS NOT NULL drop table mt_tenant; IF OBJECT_ID('test_annotation_base_entity', 'U') IS NOT NULL drop table test_annotation_base_entity; @@ -1975,6 +2134,9 @@ IF OBJECT_ID('tire_seq', 'SO') IS NOT NULL drop sequence tire_seq; IF OBJECT_ID('sa_tire', 'U') IS NOT NULL drop table sa_tire; IF OBJECT_ID('sa_tire_seq', 'SO') IS NOT NULL drop sequence sa_tire_seq; +IF OBJECT_ID('tree_entity', 'U') IS NOT NULL drop table tree_entity; +IF OBJECT_ID('tree_entity_seq', 'SO') IS NOT NULL drop sequence tree_entity_seq; + IF OBJECT_ID('trip', 'U') IS NOT NULL drop table trip; IF OBJECT_ID('trip_seq', 'SO') IS NOT NULL drop sequence trip_seq; @@ -2024,6 +2186,8 @@ IF OBJECT_ID('g_user_seq', 'SO') IS NOT NULL drop sequence g_user_seq; IF OBJECT_ID('em_user', 'U') IS NOT NULL drop table em_user; IF OBJECT_ID('em_user_seq', 'SO') IS NOT NULL drop sequence em_user_seq; +IF OBJECT_ID('user_interest_live', 'U') IS NOT NULL drop table user_interest_live; + IF OBJECT_ID('em_user_role', 'U') IS NOT NULL drop table em_user_role; IF OBJECT_ID('vehicle', 'U') IS NOT NULL drop table vehicle; @@ -2066,4 +2230,5 @@ IF OBJECT_ID('zones_seq', 'SO') IS NOT NULL drop sequence zones_seq; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('contact','U') AND name = 'ix_contact_last_name_first_name') drop index ix_contact_last_name_first_name ON contact; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('e_basic','U') AND name = 'ix_e_basic_name') drop index ix_e_basic_name ON e_basic; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('efile2_no_fk','U') AND name = 'ix_efile2_no_fk_owner_id') drop index ix_efile2_no_fk_owner_id ON efile2_no_fk; +IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('ecsm_values','U') AND name = 'ix_ecsm_values_host_id') drop index ix_ecsm_values_host_id ON ecsm_values; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('organization_node','U') AND name = 'ix_organization_node_kind') drop index ix_organization_node_kind ON organization_node;