
create table meta_user (
   recid int8 not null,
   userid text not null,
   password text not null,
   user_name text,
   user_misc text,
   user_number int4,
   group_number int4,
   given_name text,
   middle_initial text,
   surname text,
   telephone text,
   email text,
   description text,
   disabled bool,
   create_date timestamp with time zone,
   create_date_offset int4,
   account_expires timestamp with time zone,
   account_expires_offset int4,
   pwd_expires timestamp with time zone,
   pwd_expires_offset int4,
   pwd_duration int4,
   last_login timestamp with time zone,
   last_login_offset int4,
   logins int4,
   max_logins int4,
   max_tries int4,
   login_failures int4,
   spare1 int4,
   spare2 int4,
   spare3 text,
   spare4 text,
   tenantid int4 not null,
   domain_name text not null,
   sql_only_user bool not null,
   primary key (recid)
);

create table meta_user__8 (
   parent__id int8 not null,
   u_misc1 int4,
   u_misc2 text,
   list__index int4 not null,
   primary key (parent__id, list__index)
);

create table alltypes (
   recid int8 not null,
   char text not null,
   date date,
   decimal numeric(50,2),
   int int4,
   int64 int8,
   bool bool,
   dt timestamp,
   dt_tz timestamp with time zone,
   dt_tz_offset int4,
   blob oid,
   clob text,
   raw bytea,
   frecid int4,
   primary key (recid)
);

create table customer (
   recid int8 not null,
   customernum int4,
   customername text,
   customeraddress text,
   customeremail text,
   active bool,
   turnover numeric(50,10),
   employees int8,
   established date,
   created timestamp,
   updated timestamp with time zone,
   updated_offset int4,
   logo oid,
   description text,
   primary key (recid)
);

create table item (
   recid int8 not null,
   itemnum int4,
   itemname text,
   price numeric(50,10),
   weight numeric(50,10),
   primary key (recid)
);

create table order_ (
   recid int8 not null,
   ordernum int4,
   customernum int4,
   orderdate date,
   shipdate date,
   comment text,
   primary key (recid)
);

create table order___4 (
   parent__id int8 not null,
   address text,
   list__index int4 not null,
   primary key (parent__id, list__index)
);

create table orderline (
   recid int8 not null,
   ordernum int4,
   itemnum int4,
   price numeric(50,3),
   quantity int4,
   primary key (recid)
);

create table test (
   recid int8 not null,
   f1 text not null,
   primary key (recid)
);

create table ttwi (
   recid int8 not null,
   if1 text,
   if2 text,
   primary key (recid)
);

create table ttwi_if1 (
   parent__id int8 not null,
   word text not null,
   primary key (parent__id, word)
);

create table ttwi_if2 (
   parent__id int8 not null,
   word text not null,
   primary key (parent__id, word)
);

create index meta_user__8_fkey on meta_user__8 (parent__id);

alter TABLE meta_user__8
   add constraint FK_META_USER__8
   foreign key (parent__id)
   references meta_user
   on delete cascade;

create index order___4_fkey on order___4 (parent__id);

alter TABLE order___4
   add constraint FK_ORDER___4
   foreign key (parent__id)
   references order_
   on delete cascade;

create index fkidx_ttwi_if1 on ttwi_if1 (parent__id);

alter table ttwi_if1
   add constraint fk_ttwi_if1
   foreign key (parent__id)
   references ttwi
   on delete cascade
   on update cascade;

create index fkidx_ttwi_if2 on ttwi_if2 (parent__id);

alter table ttwi_if2
   add constraint fk_ttwi_if2
   foreign key (parent__id)
   references ttwi
   on delete cascade
   on update cascade;

