/* ============================================================ */ /* Nom de la base : CALENDRIER */ /* Nom de SGBD : InterBase 6 */ /* Date de création : 07/11/2003 10:55 */ /* ============================================================ */ /* ============================================================ */ /* Table : T_ANNEE_CAN */ /* ============================================================ */ create table T_ANNEE_CAN ( CAN_ID SMALLINT not null constraint CKC_CAN_ID_T_ANNEE_ check (CAN_ID between 1 and 9999), CAN_BISEXTILE SMALLINT not null, constraint PK_T_ANNEE_CAN primary key (CAN_ID) ); /* ============================================================ */ /* Table : T_MOIS_CMS */ /* ============================================================ */ create table T_MOIS_CMS ( CMS_ID SMALLINT not null constraint CKC_CMS_ID_T_MOIS_C check (CMS_ID between 1 and 12), CMS_LIBELLE CHAR(32) not null, constraint PK_T_MOIS_CMS primary key (CMS_ID) ); /* ============================================================ */ /* Table : T_JOUR_MOIS_CJM */ /* ============================================================ */ create table T_JOUR_MOIS_CJM ( CJM_ID SMALLINT not null constraint CKC_CJM_ID_T_JOUR_M check (CJM_ID between 1 and 31), constraint PK_T_JOUR_MOIS_CJM primary key (CJM_ID) ); /* ============================================================ */ /* Table : T_SEMAINE_CSM */ /* ============================================================ */ create table T_SEMAINE_CSM ( CSM_ID SMALLINT not null constraint CKC_CSM_ID_T_SEMAIN check (CSM_ID between 1 and 53), constraint PK_T_SEMAINE_CSM primary key (CSM_ID) ); /* ============================================================ */ /* Table : T_JOUR_FERIE_MOBILE_CFM */ /* ============================================================ */ create table T_JOUR_FERIE_MOBILE_CFM ( CFM_ID SMALLINT not null constraint CKC_CFM_ID_T_JOUR_F check (CFM_ID >= 1), CFM_LIBELLE CHAR(64) not null, constraint PK_T_JOUR_FERIE_MOBILE_CFM primary key (CFM_ID) ); /* ============================================================ */ /* Table : T_JOUR_SEMAINE_CJS */ /* ============================================================ */ create table T_JOUR_SEMAINE_CJS ( CJS_ID SMALLINT not null constraint CKC_CJS_ID_T_JOUR_S check (CJS_ID between 1 and 7), CJS_LIBELLE CHAR(32) not null, constraint PK_T_JOUR_SEMAINE_CJS primary key (CJS_ID) ); /* ============================================================ */ /* Table : T_JOUR_ANNEE_CJA */ /* ============================================================ */ create table T_JOUR_ANNEE_CJA ( CJA_ID SMALLINT not null constraint CKC_CJA_ID_T_JOUR_A check (CJA_ID between 1 and 366), constraint PK_T_JOUR_ANNEE_CJA primary key (CJA_ID) ); /* ============================================================ */ /* Table : T_TRIMESTRE_CTR */ /* ============================================================ */ create table T_TRIMESTRE_CTR ( CTR_ID SMALLINT not null constraint CKC_CTR_ID_T_TRIMES check (CTR_ID between 1 and 4), CTR_LIBELLE CHAR(32) not null, constraint PK_T_TRIMESTRE_CTR primary key (CTR_ID) ); /* ============================================================ */ /* Table : T_SEMESTRE_CST */ /* ============================================================ */ create table T_SEMESTRE_CST ( CST_ID SMALLINT not null constraint CKC_CST_ID_T_SEMEST check (CST_ID between 1 and 2), CST_LIBELLE CHAR(32) not null, constraint PK_T_SEMESTRE_CST primary key (CST_ID) ); /* ============================================================ */ /* Table : T_JOUR_CJR */ /* ============================================================ */ create table T_JOUR_CJR ( CJR_DATE DATE not null, CAN_ID SMALLINT constraint CKC_CAN_ID_T_JOUR_C check (CAN_ID is null or (CAN_ID between 1 and 9999 )), CMS_ID SMALLINT constraint CKC_CMS_ID_T_JOUR_C check (CMS_ID is null or (CMS_ID between 1 and 12 )), CJM_ID SMALLINT constraint CKC_CJM_ID_T_JOUR_C check (CJM_ID is null or (CJM_ID between 1 and 31 )), CSM_ID SMALLINT constraint CKC_CSM_ID_T_JOUR_C check (CSM_ID is null or (CSM_ID between 1 and 53 )), CJS_ID SMALLINT constraint CKC_CJS_ID_T_JOUR_C check (CJS_ID is null or (CJS_ID between 1 and 7 )), CJA_ID SMALLINT constraint CKC_CJA_ID_T_JOUR_C check (CJA_ID is null or (CJA_ID between 1 and 366 )), CTR_ID SMALLINT constraint CKC_CTR_ID_T_JOUR_C check (CTR_ID is null or (CTR_ID between 1 and 4 )), CST_ID SMALLINT constraint CKC_CST_ID_T_JOUR_C check (CST_ID is null or (CST_ID between 1 and 2 )), CJR_RANG_JOUR INTEGER not null constraint CKC_CJR_RANG_JOUR_T_JOUR_C check (CJR_RANG_JOUR >= 1), CJR_RANG_SEMAINE DECIMAL(10,4) , CJR_RANG_MOIS DECIMAL(10,4) , CJR_RANG_TRIMESTRE DECIMAL(10,4) , CJR_RANG_SEMESTRE DECIMAL(10,4) , CJR_RANG_AN DECIMAL(10,4) , CJR_ALEA INTEGER not null constraint CKC_CJR_ALEA_T_JOUR_C check (CJR_ALEA >= 1), constraint PK_T_JOUR_CJR primary key (CJR_DATE) ); /* ============================================================ */ /* Index : IDX_RANG_JOUR */ /* ============================================================ */ create unique ASC index IDX_RANG_JOUR on T_JOUR_CJR (CJR_RANG_JOUR); /* ============================================================ */ /* Index : IDX_RANG_SEMAINE */ /* ============================================================ */ create unique ASC index IDX_RANG_SEMAINE on T_JOUR_CJR (CJR_RANG_SEMAINE); /* ============================================================ */ /* Index : IDX_RANG_MOIS */ /* ============================================================ */ create unique ASC index IDX_RANG_MOIS on T_JOUR_CJR (CJR_RANG_MOIS); /* ============================================================ */ /* Index : IDX_RANG_TRI */ /* ============================================================ */ create unique ASC index IDX_RANG_TRI on T_JOUR_CJR (CJR_RANG_TRIMESTRE); /* ============================================================ */ /* Index : IDX_RANG_SMT */ /* ============================================================ */ create unique ASC index IDX_RANG_SMT on T_JOUR_CJR (CJR_RANG_SEMESTRE); /* ============================================================ */ /* Index : IDX_RANG_AN */ /* ============================================================ */ create unique ASC index IDX_RANG_AN on T_JOUR_CJR (CJR_RANG_AN); /* ============================================================ */ /* Table : T_JOUR_FERIE_FIXE_CFF */ /* ============================================================ */ create table T_JOUR_FERIE_FIXE_CFF ( CMS_ID SMALLINT not null constraint CKC_CMS_ID_T_JOUR_F check (CMS_ID between 1 and 12), CJM_ID SMALLINT not null constraint CKC_CJM_ID_T_JOUR_F check (CJM_ID between 1 and 31), CFF_LIBELLE CHAR(64) not null, constraint PK_T_JOUR_FERIE_FIXE_CFF primary key (CMS_ID, CJM_ID) ); /* ============================================================ */ /* Table : TJ_SAPPLIQUE_CFA */ /* ============================================================ */ create table TJ_SAPPLIQUE_CFA ( CJR_DATE DATE not null, CFM_ID SMALLINT not null constraint CKC_CFM_ID_TJ_SAPPL check (CFM_ID >= 1), constraint PK_TJ_SAPPLIQUE_CFA primary key (CJR_DATE, CFM_ID) ); alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_PAN_T_ANNEE_ foreign key (CAN_ID) references T_ANNEE_CAN; alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_PMS_T_MOIS_C foreign key (CMS_ID) references T_MOIS_CMS; alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_CJM_T_JOUR_M foreign key (CJM_ID) references T_JOUR_MOIS_CJM; alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_PSM_T_SEMAIN foreign key (CSM_ID) references T_SEMAINE_CSM; alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_PJS_T_JOUR_S foreign key (CJS_ID) references T_JOUR_SEMAINE_CJS; alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_PJA_T_JOUR_A foreign key (CJA_ID) references T_JOUR_ANNEE_CJA; alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_PTR_T_TRIMES foreign key (CTR_ID) references T_TRIMESTRE_CTR; alter table T_JOUR_CJR add constraint FK_T_JOUR_C_L_PJR_PST_T_SEMEST foreign key (CST_ID) references T_SEMESTRE_CST; alter table T_JOUR_FERIE_FIXE_CFF add constraint FK_T_JOUR_F_L_PJF_CJM_T_JOUR_M foreign key (CJM_ID) references T_JOUR_MOIS_CJM; alter table T_JOUR_FERIE_FIXE_CFF add constraint FK_T_JOUR_F_L_PJF_PMS_T_MOIS_C foreign key (CMS_ID) references T_MOIS_CMS; alter table TJ_SAPPLIQUE_CFA add constraint FK_TJ_SAPPL_L_PJR_PFM_T_JOUR_C foreign key (CJR_DATE) references T_JOUR_CJR; alter table TJ_SAPPLIQUE_CFA add constraint FK_TJ_SAPPL_L_PFM_PJR_T_JOUR_F foreign key (CFM_ID) references T_JOUR_FERIE_MOBILE_CFM;