Structure de la base de données : Différence entre versions
(→Structure) |
|||
(21 révisions intermédiaires par 3 utilisateurs non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
+ | =[[Media:OpenFlyers_database_schema.png|Schéma de la structure de la base de données]]= | ||
+ | |||
=Structure= | =Structure= | ||
− | <sql> | + | <sql>create table account |
− | + | ( | |
− | + | id int unsigned auto_increment | |
+ | primary key, | ||
+ | creation_date date null, | ||
+ | name text null, | ||
+ | export_account varchar(255) null, | ||
+ | activated tinyint(1) unsigned default 1 not null, | ||
+ | category tinyint(1) unsigned default 0 null, | ||
+ | account_type tinyint(1) unsigned default 0 null, | ||
+ | owner_id int unsigned default 0 not null, | ||
+ | payment_allowed tinyint(1) default 0 null, | ||
+ | budget_id int unsigned null, | ||
+ | order_num int null, | ||
+ | accounting_id int unsigned null, | ||
+ | deactivated_date datetime null, | ||
+ | group_sales tinyint(1) default 0 not null | ||
+ | ) | ||
+ | comment 'List of account'; | ||
− | + | create index idx_owner_id | |
− | + | on account (owner_id); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
CREATE TABLE `account_entry` ( | CREATE TABLE `account_entry` ( | ||
Ligne 32 : | Ligne 30 : | ||
`flow_id` int(11) DEFAULT NULL, | `flow_id` int(11) DEFAULT NULL, | ||
`account_date` datetime DEFAULT NULL, | `account_date` datetime DEFAULT NULL, | ||
− | |||
`account_id` int(11) DEFAULT NULL, | `account_id` int(11) DEFAULT NULL, | ||
`credit` decimal(15,5) DEFAULT '0.00000', | `credit` decimal(15,5) DEFAULT '0.00000', | ||
Ligne 42 : | Ligne 39 : | ||
`validated` int(1) DEFAULT '0', | `validated` int(1) DEFAULT '0', | ||
`exported` int(1) DEFAULT '0', | `exported` int(1) DEFAULT '0', | ||
+ | `registration_date` datetime DEFAULT NULL, | ||
`budget_id` int(10) unsigned DEFAULT NULL, | `budget_id` int(10) unsigned DEFAULT NULL, | ||
`product_id` int(10) unsigned DEFAULT NULL, | `product_id` int(10) unsigned DEFAULT NULL, | ||
Ligne 48 : | Ligne 46 : | ||
`lettering` int(11) DEFAULT NULL, | `lettering` int(11) DEFAULT NULL, | ||
`lettering_date` datetime DEFAULT NULL, | `lettering_date` datetime DEFAULT NULL, | ||
+ | `flow_reversal_id` int(10) unsigned DEFAULT NULL, | ||
+ | `transaction_id` text, | ||
PRIMARY KEY (`id`), | PRIMARY KEY (`id`), | ||
− | |||
KEY `idx_flow_id` (`flow_id`), | KEY `idx_flow_id` (`flow_id`), | ||
− | KEY `idx_signature_date` (`signature_date`) | + | KEY `idx_account_date` (`account_date`), |
− | ) | + | KEY `idx_signature_date` (`signature_date`), |
+ | KEY `flow_reversal_id_idx` (`flow_reversal_id`) | ||
+ | ); | ||
− | + | create table account_link | |
− | + | ( | |
− | + | account_id int unsigned default 0 not null, | |
+ | linked_account_id int unsigned default 0 not null, | ||
+ | primary key (account_id, linked_account_id) | ||
+ | ); | ||
− | + | create table account_type | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
− | + | primary key, | |
− | ) | + | name varchar(255) null, |
+ | category tinyint(1) unsigned default 0 null, | ||
+ | activated tinyint(1) default 1 null, | ||
+ | order_num int null, | ||
+ | accounting_id int unsigned null, | ||
+ | export_account_pattern varchar(255) null | ||
+ | ); | ||
− | + | create table account_type_profile | |
− | + | ( | |
− | + | account_type_id int unsigned default 0 not null, | |
+ | profile_id bigint unsigned default 0 not null, | ||
+ | primary key (account_type_id, profile_id) | ||
+ | ) | ||
+ | comment 'Linked account type and profile'; | ||
− | + | create table accounting | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
− | + | primary key, | |
− | + | name varchar(255) null, | |
− | + | unit_name varchar(255) null, | |
− | + | symbol varchar(255) null, | |
− | + | format tinyint(1) null, | |
− | + | decimal_precision int unsigned default 2 null | |
− | ) | + | ); |
− | + | create table accounting_profile | |
− | + | ( | |
− | + | accounting_id int unsigned default 0 not null, | |
+ | profile_id bigint unsigned default 0 not null, | ||
+ | primary key (accounting_id, profile_id) | ||
+ | ); | ||
− | + | create table activity_type | |
− | + | ( | |
− | + | id bigint unsigned default 0 not null | |
− | + | primary key, | |
− | ) | + | name varchar(255) null, |
+ | order_num int null, | ||
+ | activated tinyint(1) default 1 not null, | ||
+ | color int unsigned null, | ||
+ | training tinyint(1) default 0 not null | ||
+ | ) | ||
+ | comment 'list of flight type'; | ||
− | + | create table aircraft | |
− | - | + | ( |
− | - | + | id int unsigned default 0 not null |
+ | primary key, | ||
+ | ref_date datetime null, | ||
+ | ref_hours int null, | ||
+ | inspection_date datetime null, | ||
+ | inspection_time int null, | ||
+ | tolerance_time int(11) unsigned default 6000 null, | ||
+ | last_counter int null, | ||
+ | interval_visit int(11) unsigned default 30000 null, | ||
+ | time_alert1 int default 6000 null, | ||
+ | time_alert2 int default 0 null, | ||
+ | time_alert3 int default -3000 null, | ||
+ | day_alert1 smallint(3) default 15 null, | ||
+ | day_alert2 smallint(3) default 0 null, | ||
+ | day_alert3 smallint(3) default -8 null | ||
+ | ); | ||
− | + | create table aircraft_type | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
− | + | primary key, | |
− | + | flight_time_formula varchar(255) default '%DURATION' null, | |
− | + | counter_state tinyint(2) default -1 not null, | |
− | + | tolerance int default 0 null, | |
− | + | autonomy int default 5990 null, | |
− | ) | + | true_air_speed int unsigned default 0 not null, |
+ | digit_counter_number tinyint(1) unsigned default 4 not null | ||
+ | ) | ||
+ | comment 'Types of aircraft'; | ||
− | + | create table aircraft_type_allowed_status | |
− | + | ( | |
− | + | aircraft_type_id int unsigned null, | |
+ | place_num int unsigned null, | ||
+ | status_id int unsigned null | ||
+ | ) | ||
+ | comment 'List of allowed functions for each aircraft type'; | ||
− | + | create table aircraft_type_mandatory_flight_type | |
− | + | ( | |
− | + | aircraft_type_id int unsigned null, | |
− | + | activity_type_id bigint unsigned null | |
− | + | ) | |
+ | comment 'List of compulsory flight type for each aircraft type'; | ||
− | + | create table aircraft_type_uncomp_flight_type | |
− | + | ( | |
− | + | aircraft_type_id int unsigned null, | |
+ | activity_type_id bigint unsigned null | ||
+ | ) | ||
+ | comment 'List of uncompatible flight type for each aircraft type'; | ||
− | + | create table aircraft_type_validity_type | |
− | + | ( | |
− | + | aircraft_type_id int unsigned default 0 not null, | |
− | + | validity_type_id int unsigned default 0 not null, | |
− | + | check_num int unsigned default 0 not null, | |
− | + | primary key (aircraft_type_id, validity_type_id, check_num) | |
− | + | ) | |
− | + | comment 'Types of qualif required for each aircraft type'; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | create table allocation_rule | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
+ | primary key, | ||
+ | title varchar(255) not null, | ||
+ | account_id int(10) not null, | ||
+ | keyword varchar(255) null, | ||
+ | order_num int(10) not null, | ||
+ | amount tinyint(1) not null, | ||
+ | mandatory tinyint(1) default 0 not null | ||
+ | ); | ||
− | + | create table balance | |
− | + | ( | |
− | + | account_id int unsigned not null, | |
− | + | balance_date_id int unsigned not null, | |
− | + | debit decimal(15, 5) default 0.00000 null, | |
− | + | credit decimal(15, 5) default 0.00000 null, | |
− | + | primary key (account_id, balance_date_id) | |
− | + | ); | |
− | ) | + | |
− | + | create table balance_date | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
+ | primary key, | ||
+ | balance_date datetime null | ||
+ | ); | ||
− | + | create table booking | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
− | + | primary key, | |
− | + | booking_group_id int unsigned null, | |
− | + | start_date datetime null, | |
− | + | end_date datetime null | |
− | + | ); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ) | + | |
− | + | create table booking_account_entry | |
− | + | ( | |
− | + | booking_id int unsigned default 0 not null, | |
+ | account_entry_flow_id int unsigned default 0 not null, | ||
+ | primary key (booking_id, account_entry_flow_id) | ||
+ | ); | ||
− | + | create table booking_activity_type | |
− | + | ( | |
− | + | booking_id int unsigned default 0 not null, | |
− | + | activity_type_id int unsigned default 0 not null, | |
− | + | primary key (booking_id, activity_type_id) | |
− | + | ); | |
− | + | ||
− | + | ||
− | + | ||
− | ) | + | |
− | + | create table booking_changelog | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
+ | primary key, | ||
+ | booking_id int unsigned not null, | ||
+ | person_id int unsigned not null, | ||
+ | changelog_date datetime not null, | ||
+ | booking_state text null | ||
+ | ); | ||
− | + | create table booking_person | |
− | + | ( | |
− | + | booking_id int unsigned default 0 not null, | |
− | + | person_id int unsigned default 0 not null, | |
− | ) | + | place_num int unsigned null, |
+ | status_id int unsigned null, | ||
+ | primary key (booking_id, person_id) | ||
+ | ); | ||
− | + | create table booking_resource | |
− | + | ( | |
− | + | booking_id int unsigned default 0 not null, | |
+ | resource_id int unsigned default 0 not null, | ||
+ | primary key (booking_id, resource_id) | ||
+ | ); | ||
− | CREATE TABLE ` | + | CREATE TABLE `booking_training_program` ( |
− | ` | + | `booking_group_id` int(10) unsigned NOT NULL, |
− | ` | + | `training_program_id` int(10) unsigned NOT NULL, |
− | ) | + | PRIMARY KEY (`booking_group_id`,`training_program_id`), |
+ | CONSTRAINT `booking_training_program_training_program_id_fk` FOREIGN KEY (`training_program_id`) REFERENCES `training_program` (`id`) | ||
+ | ); | ||
− | + | create table budget | |
− | + | ( | |
− | + | id int unsigned auto_increment | |
+ | primary key, | ||
+ | group_id int unsigned default 0 not null, | ||
+ | name varchar(255) null, | ||
+ | order_num int null, | ||
+ | export_code varchar(255) null | ||
+ | ); | ||