Subject Re: Foreign Key - Firebird Beta 2
Author hinfun@hotmail.com
Firebird Beta 2 338

Actually i am generating around 6 tables but this are the 2 tables
being generated that has problems.


#######
/*==============================================================*/
/* Table : AMX_BRANCH_TABLE */
/*==============================================================*/
create table AMX_BRANCH_TABLE (
COMPANY_CODE VARCHAR(5) not null,
CODE VARCHAR(5) not null,
NAME VARCHAR(125),
ADDRESS VARCHAR(200),
CITY VARCHAR(25),
STATE VARCHAR(25),
COUNTRY VARCHAR(25),
POSTCODE VARCHAR(10),
PHONES VARCHAR(25),
FAX VARCHAR(25),
constraint PK_AMX_BRANCH_TABLE primary key (COMPANY_CODE, CODE)
);


/*==============================================================*/
/* Table : AMX_TP_DATE_CONTROL */
/*==============================================================*/
create table AMX_TP_DATE_CONTROL (
COMPANY_CODE VARCHAR(5) not null,
PERIOD_CODE VARCHAR(4) not null,
BRANCH_CODE VARCHAR(5) not null,
MODULES VARCHAR(3) default 'GLX' not
null
constraint CKC_MODULES_AMX_TP_D check (MODULES in
('HLX','FMX')),
TRAN_DATE TIMESTAMP not null,
constraint PK_AMX_TP_DATE_CONTROL primary key (COMPANY_CODE,
PERIOD_CODE, BRANCH_CODE, MODULES, TRAN_DATE)
);


alter table AMX_TP_DATE_CONTROL
add constraint fk_amx_2065 foreign key (COMPANY_CODE, BRANCH_CODE)
references AMX_BRANCH_TABLE (COMPANY_CODE, CODE)
on delete cascade;


######

I am using PowerDesigner 7.5 to generate the above schema and i use
basic generation.

Thanks for the quick response that gives me more confidence in using
open source product. I don't mind to stress test the database as we
have huge dataset and a complex schema which i can give opinions to
improve on it and testing out the bugs.

Sam