diff --git a/src/test/ddl-review/pg-create-all.sql b/src/test/ddl-review/pg-create-all.sql index 83b3c7d54..5b4bc24dd 100644 --- a/src/test/ddl-review/pg-create-all.sql +++ b/src/test/ddl-review/pg-create-all.sql @@ -1,4 +1,4 @@ --- Generated by ebean unknown at 2020-03-04T11:18:31.280668Z +-- Generated by ebean unknown at 2020-08-24T21:02:32.420817Z create table asimple_bean ( id bigint generated by default as identity not null, name varchar(255), @@ -307,6 +307,28 @@ create table cepproduct_category ( priority integer ); +create table ciaddress ( + id bigint generated by default as identity not null, + street_id bigint, + constraint pk_ciaddress primary key (id) +); + +create table cicustomer_parent ( + dtype integer not null, + id bigint generated by default as identity not null, + address_id bigint, + notes varchar(255), + constraint pk_cicustomer_parent primary key (id) +); + +create table cistreet_parent ( + dtype integer not null, + id bigint generated by default as identity not null, + name varchar(255), + num varchar(255), + constraint pk_cistreet_parent primary key (id) +); + create table cinh_ref ( id integer generated by default as identity not null, ref_id integer, @@ -641,7 +663,7 @@ create table d_machine_aux_use ( name varchar(255), edate date, use_secs bigint not null, - fuel decimal(38), + fuel decimal(16,3), version bigint not null, constraint pk_d_machine_aux_use primary key (id) ); @@ -652,8 +674,8 @@ create table d_machine_stats ( edate date, total_kms bigint not null, hours bigint not null, - rate decimal(38), - cost decimal(38), + rate decimal(16,3), + cost decimal(16,3), version bigint not null, constraint pk_d_machine_stats primary key (id) ); @@ -664,7 +686,7 @@ create table d_machine_use ( edate date, distance_kms bigint not null, time_secs bigint not null, - fuel decimal(38), + fuel decimal(9,3), version bigint not null, constraint pk_d_machine_use primary key (id) ); @@ -680,7 +702,7 @@ create table dperson ( id bigint generated by default as identity not null, first_name varchar(255), last_name varchar(255), - salary decimal(38), + salary decimal(16,3), constraint pk_dperson primary key (id) ); @@ -729,6 +751,16 @@ create table dc_master ( constraint pk_dc_master primary key (id) ); +create table defaults_model ( + id integer generated by default as identity not null, + constraint pk_defaults_model primary key (id) +); + +create table defaults_model_draft ( + id integer generated by default as identity not null, + constraint pk_defaults_model_draft primary key (id) +); + create table dfk_cascade ( id bigint generated by default as identity not null, name varchar(255), @@ -1511,7 +1543,7 @@ create table esoft_del_user_esoft_del_role ( create table esome_convert_type ( id bigint generated by default as identity not null, name varchar(255), - money decimal(38), + money decimal(16,3), constraint pk_esome_convert_type primary key (id) ); @@ -1801,13 +1833,7 @@ create table gen_key_sequence ( description varchar(255), constraint pk_gen_key_sequence primary key (id) ); -create sequence SEQ start with 1 increment by 1; - -create table gen_key_table ( - id bigint generated by default as identity not null, - description varchar(255), - constraint pk_gen_key_table primary key (id) -); +create sequence SEQ_NAME increment by 1; create table grand_parent_person ( identifier integer generated by default as identity not null, @@ -2739,6 +2765,23 @@ create table om_ordered_master ( constraint pk_om_ordered_master primary key (id) ); +create table oml_bar ( + id bigint generated by default as identity not null, + constraint pk_oml_bar primary key (id) +); + +create table oml_baz ( + id bigint generated by default as identity not null, + foo_id bigint not null, + constraint pk_oml_baz primary key (id) +); + +create table oml_foo ( + id bigint generated by default as identity not null, + bar_id bigint not null, + constraint pk_oml_foo primary key (id) +); + create table only_id_entity ( id bigint generated by default as identity not null, constraint pk_only_id_entity primary key (id) @@ -2778,10 +2821,30 @@ create table s_order_items ( product_variant_uuid varchar(255), order_uuid varchar(40), quantity integer not null, - amount decimal(38), + amount decimal(16,3), constraint pk_s_order_items primary key (uuid) ); +create table order_master ( + id bigint generated by default as identity not null, + constraint pk_order_master primary key (id) +); + +create table order_master_inheritance ( + id integer generated by default as identity not null, + constraint pk_order_master_inheritance primary key (id) +); + +create table order_referenced_parent ( + type varchar(31) not null, + id bigint generated by default as identity not null, + name varchar(255), + child_name varchar(255), + master_id bigint, + sort_order integer, + constraint pk_order_referenced_parent primary key (id) +); + create table or_order_ship ( id integer generated by default as identity not null, order_id integer, @@ -2792,6 +2855,25 @@ create table or_order_ship ( constraint pk_or_order_ship primary key (id) ); +create table order_toy ( + id integer generated by default as identity not null, + title varchar(255), + child_id bigint, + sort_order integer, + constraint pk_order_toy primary key (id) +); + +create table ordered_parent ( + dtype varchar(31) not null, + id integer generated by default as identity not null, + order_master_inheritance_id integer not null, + common_name varchar(255), + sort_order integer, + ordered_aname varchar(255), + ordered_bname varchar(255), + constraint pk_ordered_parent primary key (id) +); + create table organisation ( id bigint generated by default as identity not null, name varchar(255), @@ -3305,6 +3387,20 @@ create table r_orders ( constraint pk_r_orders primary key (company,order_number) ); +create table referenced_defaults_model ( + id integer generated by default as identity not null, + defaults_model_id integer not null, + name varchar(255), + constraint pk_referenced_defaults_model primary key (id) +); + +create table referenced_defaults_model_draft ( + id integer generated by default as identity not null, + defaults_model_id integer not null, + name varchar(255), + constraint pk_referenced_defaults_model_draft primary key (id) +); + create table referencing_bean ( id uuid not null, constraint pk_referencing_bean primary key (id) @@ -3900,13 +3996,38 @@ create table vehicle_lease ( active_start date, active_end date, version bigint not null, - bond decimal(38), + bond decimal(16,3), min_duration integer not null, - day_rate decimal(38), + day_rate decimal(16,3), max_days integer, constraint pk_vehicle_lease primary key (id) ); +create table version_child ( + id integer generated by default as identity not null, + name varchar(255), + parent_id integer, + version integer not null, + position integer, + constraint pk_version_child primary key (id) +); + +create table version_parent ( + id integer generated by default as identity not null, + name varchar(255), + version integer not null, + constraint pk_version_parent primary key (id) +); + +create table version_toy ( + id integer generated by default as identity not null, + name varchar(255), + child_id integer, + version integer not null, + position integer, + constraint pk_version_toy primary key (id) +); + create table warehouses ( id integer generated by default as identity not null, officezoneid integer, @@ -3987,9 +4108,13 @@ 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_order_referenced_parent_type on order_referenced_parent (type); create index ix_organization_node_kind on organization_node (kind); create unique index concurrently ix_t_detail_with_other_namexxxyy_lowername on t_detail_with_other_namexxxyy (lower(name)); create index ix_t_detail_with_other_namexxxyy_defn on t_detail_with_other_namexxxyy using hash (lower(name)) where lower(name) like 'r%'; +create index ano_3 on test_annotation_base_entity (direct); +create index ano_1 on test_annotation_base_entity (direct); +create index ano_2 on test_annotation_base_entity (direct); 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; @@ -4055,6 +4180,12 @@ alter table cepproduct_category add constraint fk_cepproduct_category_category_i create index ix_cepproduct_category_product_id on cepproduct_category (product_id); alter table cepproduct_category add constraint fk_cepproduct_category_product_id foreign key (product_id) references cepproduct (id) on delete restrict on update restrict; +create index ix_ciaddress_street_id on ciaddress (street_id); +alter table ciaddress add constraint fk_ciaddress_street_id foreign key (street_id) references cistreet_parent (id) on delete restrict on update restrict; + +create index ix_cicustomer_parent_address_id on cicustomer_parent (address_id); +alter table cicustomer_parent add constraint fk_cicustomer_parent_address_id foreign key (address_id) references ciaddress (id) on delete restrict on update restrict; + create index ix_cinh_ref_ref_id on cinh_ref (ref_id); alter table cinh_ref add constraint fk_cinh_ref_ref_id foreign key (ref_id) references cinh_root (id) on delete restrict on update restrict; @@ -4162,6 +4293,8 @@ alter table drot_drol add constraint fk_drot_drol_drol foreign key (drol_id) ref create index ix_dc_detail_master_id on dc_detail (master_id); alter table dc_detail add constraint fk_dc_detail_master_id foreign key (master_id) references dc_master (id) on delete restrict on update restrict; +alter table defaults_model add constraint fk_defaults_model_id foreign key (id) references defaults_model_draft (id) on delete restrict on update restrict; + create index ix_dfk_cascade_one_id on dfk_cascade (one_id); alter table dfk_cascade add constraint fk_dfk_cascade_one_id foreign key (one_id) references dfk_cascade_one (id) on delete cascade on update cascade; @@ -4542,6 +4675,12 @@ alter table om_basic_child add constraint fk_om_basic_child_parent_id foreign ke 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; +create index ix_oml_baz_foo_id on oml_baz (foo_id); +alter table oml_baz add constraint fk_oml_baz_foo_id foreign key (foo_id) references oml_foo (id) on delete restrict on update restrict; + +create index ix_oml_foo_bar_id on oml_foo (bar_id); +alter table oml_foo add constraint fk_oml_foo_bar_id foreign key (bar_id) references oml_bar (id) on delete restrict on update restrict; + create index ix_o_order_kcustomer_id on o_order (kcustomer_id); alter table o_order add constraint fk_o_order_kcustomer_id foreign key (kcustomer_id) references o_customer (id) on delete restrict on update restrict; @@ -4554,9 +4693,18 @@ alter table o_order_detail add constraint fk_o_order_detail_product_id foreign k create index ix_s_order_items_order_uuid on s_order_items (order_uuid); alter table s_order_items add constraint fk_s_order_items_order_uuid foreign key (order_uuid) references s_orders (uuid) on delete restrict on update restrict; +create index ix_order_referenced_parent_master_id on order_referenced_parent (master_id); +alter table order_referenced_parent add constraint fk_order_referenced_parent_master_id foreign key (master_id) references order_master (id) on delete restrict on update restrict; + create index ix_or_order_ship_order_id on or_order_ship (order_id); alter table or_order_ship add constraint fk_or_order_ship_order_id foreign key (order_id) references o_order (id) on delete restrict on update restrict; +create index ix_order_toy_child_id on order_toy (child_id); +alter table order_toy add constraint fk_order_toy_child_id foreign key (child_id) references order_referenced_parent (id) on delete restrict on update restrict; + +create index ix_ordered_parent_order_master_inheritance_id on ordered_parent (order_master_inheritance_id); +alter table ordered_parent add constraint fk_ordered_parent_order_master_inheritance_id foreign key (order_master_inheritance_id) references order_master_inheritance (id) on delete restrict on update restrict; + alter table organization_node add constraint fk_organization_node_parent_tree_node_id foreign key (parent_tree_node_id) references organization_tree_node (id) on delete restrict on update restrict; create index ix_orp_detail_master_id on orp_detail (master_id); @@ -4658,6 +4806,14 @@ alter table question add constraint fk_question_groupobjectid foreign key (group create index ix_r_orders_customer on r_orders (company,customername); alter table r_orders add constraint fk_r_orders_customer foreign key (company,customername) references rcustomer (company,name) on delete restrict on update restrict; +alter table referenced_defaults_model add constraint fk_referenced_defaults_model_id foreign key (id) references referenced_defaults_model_draft (id) on delete restrict on update restrict; + +create index ix_referenced_defaults_model_defaults_model_id on referenced_defaults_model (defaults_model_id); +alter table referenced_defaults_model add constraint fk_referenced_defaults_model_defaults_model_id foreign key (defaults_model_id) references defaults_model (id) on delete restrict on update restrict; + +create index ix_referenced_defaults_model_draft_defaults_model_id on referenced_defaults_model_draft (defaults_model_id); +alter table referenced_defaults_model_draft add constraint fk_referenced_defaults_model_draft_defaults_model_id foreign key (defaults_model_id) references defaults_model_draft (id) on delete restrict on update restrict; + create index ix_rel_master_detail_id on rel_master (detail_id); alter table rel_master add constraint fk_rel_master_detail_id foreign key (detail_id) references rel_detail (id) on delete restrict on update restrict; @@ -4779,6 +4935,12 @@ alter table vehicle_driver add constraint fk_vehicle_driver_vehicle_id foreign k create index ix_vehicle_driver_address_id on vehicle_driver (address_id); alter table vehicle_driver add constraint fk_vehicle_driver_address_id foreign key (address_id) references o_address (id) on delete restrict on update restrict; +create index ix_version_child_parent_id on version_child (parent_id); +alter table version_child add constraint fk_version_child_parent_id foreign key (parent_id) references version_parent (id) on delete restrict on update restrict; + +create index ix_version_toy_child_id on version_toy (child_id); +alter table version_toy add constraint fk_version_toy_child_id foreign key (child_id) references version_child (id) on delete restrict on update restrict; + create index ix_warehouses_officezoneid on warehouses (officezoneid); alter table warehouses add constraint fk_warehouses_officezoneid foreign key (officezoneid) references zones (id) on delete restrict on update restrict; diff --git a/src/test/ddl-review/pg-drop-all.sql b/src/test/ddl-review/pg-drop-all.sql index 8f26a3613..e3fbd4432 100644 --- a/src/test/ddl-review/pg-drop-all.sql +++ b/src/test/ddl-review/pg-drop-all.sql @@ -1,4 +1,4 @@ --- Generated by ebean unknown at 2020-03-04T11:18:31.280668Z +-- Generated by ebean unknown at 2020-08-24T21:02:32.420817Z alter table if exists bar drop constraint if exists fk_bar_foo_id; drop index if exists ix_bar_foo_id; @@ -64,6 +64,12 @@ drop index if exists ix_cepproduct_category_category_id; alter table if exists cepproduct_category drop constraint if exists fk_cepproduct_category_product_id; drop index if exists ix_cepproduct_category_product_id; +alter table if exists ciaddress drop constraint if exists fk_ciaddress_street_id; +drop index if exists ix_ciaddress_street_id; + +alter table if exists cicustomer_parent drop constraint if exists fk_cicustomer_parent_address_id; +drop index if exists ix_cicustomer_parent_address_id; + alter table if exists cinh_ref drop constraint if exists fk_cinh_ref_ref_id; drop index if exists ix_cinh_ref_ref_id; @@ -171,6 +177,8 @@ drop index if exists ix_drot_drol_drol; alter table if exists dc_detail drop constraint if exists fk_dc_detail_master_id; drop index if exists ix_dc_detail_master_id; +alter table if exists defaults_model drop constraint if exists fk_defaults_model_id; + alter table if exists dfk_cascade drop constraint if exists fk_dfk_cascade_one_id; drop index if exists ix_dfk_cascade_one_id; @@ -551,6 +559,12 @@ drop index if exists ix_om_basic_child_parent_id; alter table if exists om_ordered_detail drop constraint if exists fk_om_ordered_detail_master_id; drop index if exists ix_om_ordered_detail_master_id; +alter table if exists oml_baz drop constraint if exists fk_oml_baz_foo_id; +drop index if exists ix_oml_baz_foo_id; + +alter table if exists oml_foo drop constraint if exists fk_oml_foo_bar_id; +drop index if exists ix_oml_foo_bar_id; + alter table if exists o_order drop constraint if exists fk_o_order_kcustomer_id; drop index if exists ix_o_order_kcustomer_id; @@ -563,9 +577,18 @@ drop index if exists ix_o_order_detail_product_id; alter table if exists s_order_items drop constraint if exists fk_s_order_items_order_uuid; drop index if exists ix_s_order_items_order_uuid; +alter table if exists order_referenced_parent drop constraint if exists fk_order_referenced_parent_master_id; +drop index if exists ix_order_referenced_parent_master_id; + alter table if exists or_order_ship drop constraint if exists fk_or_order_ship_order_id; drop index if exists ix_or_order_ship_order_id; +alter table if exists order_toy drop constraint if exists fk_order_toy_child_id; +drop index if exists ix_order_toy_child_id; + +alter table if exists ordered_parent drop constraint if exists fk_ordered_parent_order_master_inheritance_id; +drop index if exists ix_ordered_parent_order_master_inheritance_id; + alter table if exists organization_node drop constraint if exists fk_organization_node_parent_tree_node_id; alter table if exists orp_detail drop constraint if exists fk_orp_detail_master_id; @@ -667,6 +690,14 @@ drop index if exists ix_question_groupobjectid; alter table if exists r_orders drop constraint if exists fk_r_orders_customer; drop index if exists ix_r_orders_customer; +alter table if exists referenced_defaults_model drop constraint if exists fk_referenced_defaults_model_id; + +alter table if exists referenced_defaults_model drop constraint if exists fk_referenced_defaults_model_defaults_model_id; +drop index if exists ix_referenced_defaults_model_defaults_model_id; + +alter table if exists referenced_defaults_model_draft drop constraint if exists fk_referenced_defaults_model_draft_defaults_model_id; +drop index if exists ix_referenced_defaults_model_draft_defaults_model_id; + alter table if exists rel_master drop constraint if exists fk_rel_master_detail_id; drop index if exists ix_rel_master_detail_id; @@ -788,6 +819,12 @@ drop index if exists ix_vehicle_driver_vehicle_id; alter table if exists vehicle_driver drop constraint if exists fk_vehicle_driver_address_id; drop index if exists ix_vehicle_driver_address_id; +alter table if exists version_child drop constraint if exists fk_version_child_parent_id; +drop index if exists ix_version_child_parent_id; + +alter table if exists version_toy drop constraint if exists fk_version_toy_child_id; +drop index if exists ix_version_toy_child_id; + alter table if exists warehouses drop constraint if exists fk_warehouses_officezoneid; drop index if exists ix_warehouses_officezoneid; @@ -887,6 +924,12 @@ drop table if exists cepproduct cascade; drop table if exists cepproduct_category cascade; +drop table if exists ciaddress cascade; + +drop table if exists cicustomer_parent cascade; + +drop table if exists cistreet_parent cascade; + drop table if exists cinh_ref cascade; drop table if exists cinh_root cascade; @@ -991,6 +1034,10 @@ drop table if exists dc_detail cascade; drop table if exists dc_master cascade; +drop table if exists defaults_model cascade; + +drop table if exists defaults_model_draft cascade; + drop table if exists dfk_cascade cascade; drop table if exists dfk_cascade_one cascade; @@ -1253,9 +1300,7 @@ drop table if exists foo cascade; drop table if exists gen_key_identity cascade; drop table if exists gen_key_sequence cascade; -drop sequence if exists SEQ; - -drop table if exists gen_key_table cascade; +drop sequence if exists SEQ_NAME; drop table if exists grand_parent_person cascade; @@ -1557,6 +1602,12 @@ drop table if exists om_ordered_detail cascade; drop table if exists om_ordered_master cascade; +drop table if exists oml_bar cascade; + +drop table if exists oml_baz cascade; + +drop table if exists oml_foo cascade; + drop table if exists only_id_entity cascade; drop table if exists o_order cascade; @@ -1567,8 +1618,18 @@ drop table if exists s_orders cascade; drop table if exists s_order_items cascade; +drop table if exists order_master cascade; + +drop table if exists order_master_inheritance cascade; + +drop table if exists order_referenced_parent cascade; + drop table if exists or_order_ship cascade; +drop table if exists order_toy cascade; + +drop table if exists ordered_parent cascade; + drop table if exists organisation cascade; drop table if exists organization_node cascade; @@ -1697,6 +1758,10 @@ drop table if exists rcustomer cascade; drop table if exists r_orders cascade; +drop table if exists referenced_defaults_model cascade; + +drop table if exists referenced_defaults_model_draft cascade; + drop table if exists referencing_bean cascade; drop table if exists region cascade; @@ -1850,6 +1915,12 @@ drop table if exists vehicle_driver cascade; drop table if exists vehicle_lease cascade; +drop table if exists version_child cascade; + +drop table if exists version_parent cascade; + +drop table if exists version_toy cascade; + drop table if exists warehouses cascade; drop table if exists warehousesshippingzones cascade; @@ -1877,6 +1948,10 @@ drop index if exists ix_contact_last_name_first_name; drop index if exists ix_e_basic_name; drop index if exists ix_efile2_no_fk_owner_id; drop index if exists ix_ecsm_values_host_id; +drop index if exists ix_order_referenced_parent_type; drop index if exists ix_organization_node_kind; drop index concurrently if exists ix_t_detail_with_other_namexxxyy_lowername; drop index if exists ix_t_detail_with_other_namexxxyy_defn; +drop index if exists ano_3; +drop index if exists ano_1; +drop index if exists ano_2;