Structure de la base de données

From Documentation de la solution web de gestion OpenFlyers
Revision as of 10:48, 8 June 2017 by imported>Jcheng (Page créée avec « =Structure= <sql>-- -- Table structure for table `account` -- CREATE TABLE `account` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `creation_date` date DEFAULT NU... »)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Structure

<sql>-- -- Table structure for table `account` --

CREATE TABLE `account` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `creation_date` date DEFAULT NULL,
 `name` text,
 `export_account` varchar(255) DEFAULT NULL,
 `activated` tinyint(1) unsigned NOT NULL DEFAULT '1',
 `category` tinyint(1) unsigned DEFAULT '0',
 `account_type` tinyint(1) unsigned DEFAULT '0',
 `owner_id` int(10) unsigned NOT NULL DEFAULT '0',
 `payment_allowed` tinyint(1) DEFAULT '0',
 `budget_id` int(10) unsigned DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `accounting_id` int(10) unsigned DEFAULT NULL,
 `deactivated_date` datetime DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `idx_owner_id` (`owner_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of account';

-- -- Table structure for table `account_entry` --

CREATE TABLE `account_entry` (

 `id` int(11) NOT NULL AUTO_INCREMENT,
 `flow_id` int(11) DEFAULT NULL,
 `account_date` datetime DEFAULT NULL,
 `account_id` int(11) DEFAULT NULL,
 `credit` decimal(15,5) NOT NULL DEFAULT '0.00000',
 `debit` decimal(15,5) NOT NULL DEFAULT '0.00000',
 `payment_type` int(10) unsigned DEFAULT NULL,
 `payment_description` text,
 `person_delivery_id` int(10) unsigned DEFAULT NULL,
 `comments` text,
 `validated` int(1) DEFAULT '0',
 `exported` int(1) DEFAULT '0',
 `registration_date` datetime DEFAULT NULL,
 `budget_id` int(10) unsigned DEFAULT NULL,
 `product_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `idx_flow_id` (`flow_id`),
 KEY `idx_account_date` (`account_date`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of account entries';

-- -- Table structure for table `account_link` --

CREATE TABLE `account_link` (

 `account_id` int(10) unsigned NOT NULL DEFAULT '0',
 `linked_account_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`account_id`,`linked_account_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `account_type` --

CREATE TABLE `account_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) DEFAULT NULL,
 `category` tinyint(1) unsigned DEFAULT '0',
 `activated` tinyint(1) DEFAULT '1',
 `order_num` int(11) DEFAULT NULL,
 `accounting_id` int(10) unsigned DEFAULT NULL,
 `export_account_pattern` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `account_type_profile` --

CREATE TABLE `account_type_profile` (

 `account_type_id` int(10) unsigned NOT NULL DEFAULT '0',
 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`account_type_id`,`profile_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Linked account type\r\nfield and profile';

-- -- Table structure for table `accounting` --

CREATE TABLE `accounting` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) DEFAULT NULL,
 `unit_name` varchar(255) DEFAULT NULL,
 `symbol` varchar(255) DEFAULT NULL,
 `format` tinyint(1) unsigned DEFAULT NULL,
 `decimal_precision` int(10) unsigned DEFAULT '2',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `accounting_profile` --

CREATE TABLE `accounting_profile` (

 `accounting_id` int(10) unsigned NOT NULL DEFAULT '0',
 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`accounting_id`,`profile_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `activity_type` --

CREATE TABLE `activity_type` (

 `id` int(10) unsigned NOT NULL,
 `name` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `activated` tinyint(1) NOT NULL DEFAULT '1',
 `color` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='list of flight type';

-- -- Table structure for table `aircraft` --

CREATE TABLE `aircraft` (

 `id` int(10) unsigned NOT NULL DEFAULT '0',
 `type` int(10) unsigned DEFAULT NULL,
 `ref_date` datetime DEFAULT NULL,
 `ref_hours` int(11) DEFAULT NULL,
 `inspection_date` datetime DEFAULT NULL,
 `inspection_time` int(11) DEFAULT NULL,
 `interval_visit` int(11) unsigned DEFAULT '30000',
 `time_alert1` int(11) DEFAULT '6000',
 `time_alert2` int(11) DEFAULT '0',
 `time_alert3` int(11) DEFAULT '-3000',
 `day_alert1` smallint(3) DEFAULT '15',
 `day_alert2` smallint(3) DEFAULT '0',
 `day_alert3` smallint(3) DEFAULT '-8',
 `last_counter` int(11) DEFAULT NULL,
 `tolerance_time` int(10) unsigned DEFAULT '6000',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='ALL AIRCRAFTS OF ALL AIRCLUBS';

-- -- Table structure for table `aircraft_type` --

CREATE TABLE `aircraft_type` (

 `id` int(10) unsigned NOT NULL,
 `flight_time_formula` varchar(255) DEFAULT '%DURATION',
 `counter_state` tinyint(2) NOT NULL DEFAULT '-1',
 `tolerance` int(11) DEFAULT '0',
 `autonomy` int(11) DEFAULT '5990',
 `true_air_speed` int(10) unsigned NOT NULL DEFAULT '0',
 `digit_counter_number` tinyint(1) unsigned NOT NULL DEFAULT '4',
 `order_num` int(11) DEFAULT NULL,
 `activated` tinyint(1) unsigned NOT NULL DEFAULT '1',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Types of aircraft';

-- -- Table structure for table `aircraft_type_allowed_status` --

CREATE TABLE `aircraft_type_allowed_status` (

 `aircraft_type_id` int(10) unsigned DEFAULT NULL,
 `place_num` int(10) unsigned DEFAULT NULL,
 `status_id` int(10) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of allowed functions for each aircraft type';

-- -- Table structure for table `aircraft_type_mandatory_flight_type` --

CREATE TABLE `aircraft_type_mandatory_flight_type` (

 `aircraft_type_id` int(10) unsigned DEFAULT NULL,
 `flight_type_id` int(10) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of compulsory flight type for each aircraft type';

-- -- Table structure for table `aircraft_type_uncomp_flight_type` --

CREATE TABLE `aircraft_type_uncomp_flight_type` (

 `aircraft_type_id` int(10) unsigned DEFAULT NULL,
 `flight_type_id` int(10) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of uncompatible flight type for each aircraft type';

-- -- Table structure for table `aircraft_type_validity_type` --

CREATE TABLE `aircraft_type_validity_type` (

 `aircraft_type_id` int(10) unsigned NOT NULL DEFAULT '0',
 `validity_type_id` int(10) unsigned NOT NULL DEFAULT '0',
 `check_num` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`aircraft_type_id`,`validity_type_id`,`check_num`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Types of qualif required for each aircraft type';

-- -- Table structure for table `balance` --

CREATE TABLE `balance` (

 `account_id` int(10) unsigned NOT NULL,
 `balance_date_id` int(10) unsigned NOT NULL,
 `debit` decimal(15,5) NOT NULL DEFAULT '0.00000',
 `credit` decimal(15,5) NOT NULL DEFAULT '0.00000',
 PRIMARY KEY (`account_id`,`balance_date_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `balance_date` --

CREATE TABLE `balance_date` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `balance_date` datetime DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `booking` --

CREATE TABLE `booking` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `booking_group_id` int(10) unsigned DEFAULT NULL,
 `start_date` datetime DEFAULT NULL,
 `end_date` datetime DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='RECORDS ALL THE SLOTS OF ALL AIRCRAFTS OF ALL AIRCLUBS';

-- -- Table structure for table `booking_account_entry` --

CREATE TABLE `booking_account_entry` (

 `booking_id` int(10) unsigned NOT NULL DEFAULT '0',
 `account_entry_flow_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`booking_id`,`account_entry_flow_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `booking_activity_type` --

CREATE TABLE `booking_activity_type` (

 `booking_id` int(10) unsigned NOT NULL DEFAULT '0',
 `activity_type_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`booking_id`,`activity_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `booking_changelog` --

CREATE TABLE `booking_changelog` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `booking_id` int(10) unsigned NOT NULL,
 `person_id` int(10) unsigned NOT NULL,
 `changelog_date` datetime NOT NULL,
 `booking_state` text,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `booking_person` --

CREATE TABLE `booking_person` (

 `booking_id` int(10) unsigned NOT NULL DEFAULT '0',
 `person_id` int(10) unsigned NOT NULL DEFAULT '0',
 `place_num` int(10) unsigned DEFAULT NULL,
 `status_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`booking_id`,`person_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `booking_resource` --

CREATE TABLE `booking_resource` (

 `booking_id` int(10) unsigned NOT NULL DEFAULT '0',
 `resource_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`booking_id`,`resource_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `budget` --

CREATE TABLE `budget` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `group_id` int(10) unsigned NOT NULL DEFAULT '0',
 `name` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `export_code` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `budget_group` --

CREATE TABLE `budget_group` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `business_field` --

CREATE TABLE `business_field` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `variable` varchar(255) DEFAULT NULL,
 `label` varchar(255) NOT NULL,
 `value_type` varchar(40) NOT NULL,
 `category` varchar(255) NOT NULL,
 `order_num` int(11) NOT NULL,
 `dsn` varchar(20) DEFAULT 'customer',
 `compulsory_fill` tinyint(1) DEFAULT '0',
 `linked_category` varchar(255) DEFAULT NULL,
 `linked_extra_field_id` int(10) unsigned DEFAULT NULL,
 `linked_field_name` varchar(255) DEFAULT NULL,
 `max_display` int(10) DEFAULT '-1',
 `formula` text,
 `default_value` text,
 `placeholder` text,
 PRIMARY KEY (`id`),
 UNIQUE KEY `variable` (`variable`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of extra form field';

-- -- Table structure for table `business_field_activity_type` --

CREATE TABLE `business_field_activity_type` (

 `business_field_id` int(10) unsigned NOT NULL DEFAULT '0',
 `activity_type_id` int(10) unsigned NOT NULL DEFAULT '0',
 `business_field_group_id` int(10) unsigned NOT NULL DEFAULT '0',
 `visibility_type` tinyint(1) unsigned DEFAULT NULL,
 PRIMARY KEY (`business_field_id`,`activity_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `business_field_content` --

CREATE TABLE `business_field_content` (

 `category_id` int(10) unsigned NOT NULL,
 `extra_field_id` int(10) unsigned NOT NULL,
 `person_id` int(10) unsigned NOT NULL DEFAULT '0',
 `content` text,
 `placeholder` text,
 PRIMARY KEY (`category_id`,`extra_field_id`,`person_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Content of extra form field';

-- -- Table structure for table `business_field_group` --

CREATE TABLE `business_field_group` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `label` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `club` --

CREATE TABLE `club` (

 `id` int(10) NOT NULL DEFAULT '0',
 `name` varchar(255) DEFAULT NULL,
 `info_cell` text,
 `logo` longblob,
 `logo_name` varchar(255) DEFAULT NULL,
 `logo_ext` varchar(25) DEFAULT NULL,
 `logo_size` int(11) DEFAULT NULL,
 `first_hour_displayed` time DEFAULT NULL,
 `last_hour_displayed` time DEFAULT NULL,
 `usual_profiles` bigint(20) unsigned DEFAULT NULL,
 `icao` varchar(6) DEFAULT NULL,
 `default_slot_range` int(10) unsigned DEFAULT NULL,
 `min_slot_range` tinyint(3) unsigned DEFAULT NULL,
 `twilight_range` tinyint(3) unsigned DEFAULT NULL,
 `mailing_list_name` varchar(255) DEFAULT NULL,
 `mailing_list_type` varchar(255) DEFAULT NULL,
 `club_site_url` varchar(255) DEFAULT NULL,
 `default_timezone` varchar(255) NOT NULL,
 `lang` varchar(255) NOT NULL,
 `admin_num` int(10) unsigned NOT NULL,
 `default_view_type` int(10) unsigned DEFAULT NULL,
 `address` varchar(255) DEFAULT NULL,
 `zipcode` varchar(255) DEFAULT NULL,
 `city` varchar(255) DEFAULT NULL,
 `state` varchar(255) DEFAULT NULL,
 `country` varchar(255) DEFAULT NULL,
 `phone` varchar(255) DEFAULT NULL,
 `fax` varchar(255) DEFAULT NULL,
 `email` varchar(255) DEFAULT NULL,
 `default_notification` int(3) unsigned DEFAULT NULL,
 `welcome_cell` text,
 `business` text,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='DESCRIPTION OF ALL AIRCLUBS';

-- -- Table structure for table `criteria` --

CREATE TABLE `criteria` (

 `id` int(11) NOT NULL AUTO_INCREMENT,
 `label` varchar(255) NOT NULL,
 `predicate` text NOT NULL,
 `order_num` int(11) DEFAULT NULL,
 `dsn` varchar(20) DEFAULT 'customer',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `criteria_profile` --

CREATE TABLE `criteria_profile` (

 `criteria_id` int(10) unsigned NOT NULL,
 `profile_id` bigint(20) unsigned NOT NULL,
 PRIMARY KEY (`criteria_id`,`profile_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `customer_bill_entry` --

CREATE TABLE `customer_bill_entry` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `flow_id` int(10) unsigned DEFAULT NULL,
 `account_entry_id` int(10) unsigned DEFAULT NULL,
 `account_entry_flow_id` int(10) unsigned DEFAULT NULL,
 `owner_category` int(10) unsigned DEFAULT NULL,
 `owner_id` int(10) unsigned DEFAULT NULL,
 `customer_bill_id` int(10) unsigned DEFAULT NULL,
 `product_id` int(10) unsigned DEFAULT NULL,
 `qty` decimal(15,5) DEFAULT '0.00000',
 `unit_price` decimal(15,5) DEFAULT '0.00000',
 `debit` decimal(15,5) DEFAULT '0.00000',
 `credit` decimal(15,5) DEFAULT '0.00000',
 `bill_date` datetime DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `idx_account_entry_id` (`account_entry_id`),
 KEY `idx_account_entry_flow_id` (`account_entry_flow_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `customer_bill_file` --

CREATE TABLE `customer_bill_file` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `file_type` varchar(255) DEFAULT NULL,
 `content` longblob,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `default_display` --

CREATE TABLE `default_display` (

 `person_id` int(10) unsigned NOT NULL DEFAULT '0',
 `display_key` varchar(255) NOT NULL DEFAULT ,
 `display_value` text,
 PRIMARY KEY (`person_id`,`display_key`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `default_multi_display` --

CREATE TABLE `default_multi_display` (

 `resource_type` char(30) NOT NULL,
 `person_id` int(10) unsigned NOT NULL,
 `resource_id` int(10) unsigned NOT NULL,
 `display_value` text,
 PRIMARY KEY (`resource_type`,`person_id`,`resource_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `email_sent` --

CREATE TABLE `email_sent` (

 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
 `message_id` varchar(150) NOT NULL,
 `sender` varchar(255) NOT NULL,
 `title` varchar(255) NOT NULL,
 `category` tinyint(3) unsigned NOT NULL,
 `category_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `message_id_UNIQUE` (`message_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `email_sent_recipient` --

CREATE TABLE `email_sent_recipient` (

 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
 `email_sent_id` bigint(20) unsigned NOT NULL,
 `person_id` int(10) unsigned NOT NULL,
 `email` varchar(255) DEFAULT NULL,
 `recipient_type` tinyint(3) unsigned DEFAULT NULL,
 `smtp_status_category` varchar(30) DEFAULT NULL,
 `email_status` tinyint(3) unsigned DEFAULT NULL,
 `update_date` datetime NOT NULL,
 PRIMARY KEY (`id`),
 KEY `email_sent_id_idx` (`email_sent_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `exceptionnal_inst_date` --

CREATE TABLE `exceptionnal_inst_date` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `person_id` int(10) unsigned NOT NULL,
 `start_date` datetime DEFAULT NULL,
 `end_date` datetime DEFAULT NULL,
 `presence` tinyint(1) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `extra_field_profile` --

CREATE TABLE `extra_field_profile` (

 `extra_field_id` int(10) unsigned NOT NULL DEFAULT '0',
 `booking_popup_display_4_profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`extra_field_id`,`booking_popup_display_4_profile_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `facebook` --

CREATE TABLE `facebook` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `category` int(10) unsigned NOT NULL,
 `owner_id` int(10) unsigned NOT NULL,
 `small` blob,
 `original` mediumblob NOT NULL,
 `label` text,
 `description` text,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `favorite_icao` --

CREATE TABLE `favorite_icao` (

 `icao` varchar(6) NOT NULL DEFAULT ,
 PRIMARY KEY (`icao`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='favorite airfield list';

-- -- Table structure for table `favorite_report` --

CREATE TABLE `favorite_report` (

 `report_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`report_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `favorite_report_profile` --

CREATE TABLE `favorite_report_profile` (

 `report_id` int(10) unsigned NOT NULL,
 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`report_id`,`profile_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `fhp_aircraft_type` --

CREATE TABLE `fhp_aircraft_type` (

 `fhp_id` int(10) NOT NULL DEFAULT '0',
 `aircraft_type_id` int(10) NOT NULL DEFAULT '0',
 PRIMARY KEY (`fhp_id`,`aircraft_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='flight hour pricing aircraft type list';

-- -- Table structure for table `fhp_flight_type` --

CREATE TABLE `fhp_flight_type` (

 `fhp_id` int(10) NOT NULL DEFAULT '0',
 `flight_type_id` int(10) NOT NULL DEFAULT '0',
 `excluded` tinyint(1) unsigned DEFAULT '0',
 PRIMARY KEY (`fhp_id`,`flight_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='flight hour pricing flight type list';

-- -- Table structure for table `fhp_profile` --

CREATE TABLE `fhp_profile` (

 `fhp_id` int(10) unsigned NOT NULL,
 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `place_num` tinyint(1) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`fhp_id`,`profile_id`,`place_num`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `file` --

CREATE TABLE `file` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) DEFAULT NULL,
 `content` mediumblob,
 `file_type` varchar(255) DEFAULT NULL,
 `category` tinyint(1) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `flight` --

CREATE TABLE `flight` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `aircraft_id` int(10) unsigned DEFAULT NULL,
 `start_date` datetime DEFAULT NULL,
 `duration` int(10) unsigned DEFAULT NULL,
 `flight_type_id` int(10) unsigned DEFAULT NULL,
 `people_onboard` int(10) unsigned DEFAULT NULL,
 `departure_location_id` int(10) unsigned DEFAULT NULL,
 `arrival_location_id` int(10) unsigned DEFAULT NULL,
 `counter_departure` int(10) unsigned DEFAULT NULL,
 `counter_arrival` int(10) unsigned DEFAULT NULL,
 `landing_number` int(10) unsigned DEFAULT NULL,
 `airborne` tinyint(1) unsigned DEFAULT NULL,
 `validated` tinyint(3) unsigned DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='list of flight';

-- -- Table structure for table `flight_account_entry` --

CREATE TABLE `flight_account_entry` (

 `flight_id` int(10) unsigned NOT NULL DEFAULT '0',
 `account_entry_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`flight_id`,`account_entry_id`),
 KEY `idx_account_entry_id` (`account_entry_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='flight account entry join';

-- -- Table structure for table `flight_hours_pricing` --

CREATE TABLE `flight_hours_pricing` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` text,
 `price_formula` text,
 `left_account_id` int(10) unsigned DEFAULT NULL,
 `right_account_id` int(10) unsigned DEFAULT NULL,
 `left_account_type` tinyint(1) unsigned DEFAULT '0',
 `right_account_type` tinyint(1) unsigned DEFAULT '0',
 `credit_budget_id` int(10) unsigned DEFAULT NULL,
 `debit_budget_id` int(10) unsigned DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `product_id` int(10) unsigned DEFAULT NULL,
 `sale_trigger_id` int(10) unsigned DEFAULT '0',
 `query` text,
 `variable_formula` varchar(255) DEFAULT NULL,
 `extra_field_id` int(10) unsigned DEFAULT NULL,
 `debit_bill_num` int(10) unsigned DEFAULT NULL,
 `credit_bill_num` int(10) unsigned DEFAULT NULL,
 `qty_formula` text,
 `unit_price_formula` text,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='list of flight hours pricing formula';

-- -- Table structure for table `flight_pilot` --

CREATE TABLE `flight_pilot` (

 `flight_id` int(10) unsigned NOT NULL,
 `pilot_id` int(10) unsigned NOT NULL,
 `status_id` int(10) unsigned DEFAULT NULL,
 `num` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`flight_id`,`pilot_id`,`num`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='list of crew for each flight';

-- -- Table structure for table `flight_tank_qty` --

CREATE TABLE `flight_tank_qty` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `flight_id` int(10) unsigned NOT NULL,
 `tank_id` int(10) unsigned NOT NULL,
 `quantity` varchar(255) NOT NULL DEFAULT '0.00',
 `after_flight` tinyint(1) NOT NULL DEFAULT '0',
 `account_id` int(10) unsigned DEFAULT NULL,
 `pay_type` tinyint(1) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `flight_track` --

CREATE TABLE `flight_track` (

 `flight_id` int(10) unsigned NOT NULL,
 `track_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`track_id`,`flight_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Link between flight and track';

-- -- Table structure for table `flight_type_mandatory_validity_type` --

CREATE TABLE `flight_type_mandatory_validity_type` (

 `flight_type_id` int(10) unsigned NOT NULL,
 `validity_type_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`flight_type_id`,`validity_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='list of mandatory qualification for each flight type';

-- -- Table structure for table `import` --

CREATE TABLE `import` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `label` varchar(255) NOT NULL,
 `order_num` int(11) DEFAULT NULL,
 `import_file_type` varchar(255) NOT NULL DEFAULT 'csv-comma-CRLF',
 `match_query` text,
 `uptodate_test_query` text,
 `update_query` text,
 `update_activated` tinyint(1) NOT NULL DEFAULT '0',
 `login` varchar(255) DEFAULT NULL,
 `hash_password` varchar(255) DEFAULT NULL,
 `sync_task_name` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `ip_stopped` --

CREATE TABLE `ip_stopped` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `ip` varchar(255) NOT NULL,
 `counter` tinyint(1) unsigned NOT NULL,
 `expire_date` datetime NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='BLACKLISTED IP';

-- -- Table structure for table `journal` --

CREATE TABLE `journal` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `login` varchar(255) DEFAULT NULL,
 `date_log` datetime DEFAULT NULL,
 `rights` text,
 `rights2` text,
 `action` varchar(255) DEFAULT NULL,
 `person_id` int(10) unsigned DEFAULT '0',
 PRIMARY KEY (`id`),
 KEY `idx_date_log` (`date_log`),
 KEY `idx_action` (`action`(8))

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='list of logs';

-- -- Table structure for table `key_alert` --

CREATE TABLE `key_alert` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `alert_date` datetime DEFAULT NULL,
 `status` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Key alerts';

-- -- Table structure for table `key_assignment` --

CREATE TABLE `key_assignment` (

 `key_id` tinyint(2) unsigned NOT NULL DEFAULT '0',
 `key_name` tinytext,
 `aircraft_id` int(10) unsigned DEFAULT '0',
 `key_state` tinyint(1) unsigned DEFAULT '0',
 `key_word` bigint(20) unsigned DEFAULT '0',
 PRIMARY KEY (`key_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='key assignment description';

-- -- Table structure for table `key_host` --

CREATE TABLE `key_host` (

 `id` tinyint(2) NOT NULL AUTO_INCREMENT,
 `timeout` tinyint(2) NOT NULL DEFAULT '10',
 `num_key` tinyint(2) unsigned NOT NULL DEFAULT '8',
 `ipkey` varchar(50) NOT NULL DEFAULT '127.0.0.1',
 `httpport` int(11) NOT NULL DEFAULT '4080',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='key host configuration';

-- -- Table structure for table `key_log` --

CREATE TABLE `key_log` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `log_date` datetime DEFAULT NULL,
 `action` varchar(255) DEFAULT NULL,
 `message` varchar(255) DEFAULT NULL,
 `key_id` int(10) unsigned DEFAULT NULL,
 `person_id` int(10) unsigned DEFAULT NULL,
 `xmlrpc` int(10) unsigned DEFAULT NULL,
 `error` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Key logs';

-- -- Table structure for table `location` --

CREATE TABLE `location` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(64) NOT NULL,
 `icao_name` varchar(6) DEFAULT NULL,
 `latitude` double DEFAULT NULL,
 `longitude` double DEFAULT NULL,
 `altitude` int(7) DEFAULT NULL,
 `weather_station` int(1) unsigned DEFAULT NULL,
 `asked_counter` bigint(20) NOT NULL DEFAULT '0',
 PRIMARY KEY (`id`),
 UNIQUE KEY `icao_name` (`icao_name`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='airfields coord';

-- -- Table structure for table `log` --

CREATE TABLE `log` (

 `journal_id` int(10) unsigned NOT NULL,
 `action` varchar(255) DEFAULT NULL,
 `table_name` varchar(255) DEFAULT NULL,
 `field_name` varchar(255) DEFAULT NULL,
 `field_value` varchar(255) DEFAULT NULL,
 KEY `idx_journal_id` (`journal_id`),
 KEY `idx_field_value` (`field_value`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='part of logs';

-- -- Table structure for table `logger` --

CREATE TABLE `logger` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `serial_number` int(10) unsigned DEFAULT NULL,
 `color` varchar(20) NOT NULL DEFAULT 'red',
 `activated` tinyint(1) unsigned NOT NULL DEFAULT '1',
 `order_num` int(10) unsigned NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Logger parameters';

-- -- Table structure for table `login_stopped` --

CREATE TABLE `login_stopped` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `login` varchar(255) NOT NULL,
 `counter` tinyint(3) unsigned NOT NULL,
 `expire_date` datetime NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='BLACKLISTED LOGIN';

-- -- Table structure for table `m_component` --

CREATE TABLE `m_component` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
 `m_component_type_id` int(10) unsigned DEFAULT NULL,
 `resource_id` int(10) unsigned DEFAULT NULL,
 `order_num` int(11) NOT NULL,
 `serial_number` varchar(255) DEFAULT NULL,
 `brandnew_date` datetime DEFAULT NULL,
 `activated` tinyint(1) unsigned NOT NULL DEFAULT '1',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `m_component_type` --

CREATE TABLE `m_component_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
 `resource_type_id` int(11) DEFAULT NULL,
 `m_classification_id` int(11) DEFAULT NULL,
 `is_maintenance_check` tinyint(1) unsigned NOT NULL DEFAULT '1',
 `order_num` int(11) NOT NULL,
 `label` varchar(255) DEFAULT NULL,
 `description` varchar(255) DEFAULT NULL,
 `manufacturer` varchar(255) DEFAULT NULL,
 `manufacturer_reference` varchar(255) DEFAULT NULL,
 `part_number` varchar(255) DEFAULT NULL,
 `periodicity` int(10) unsigned DEFAULT NULL,
 `tolerance` int(10) unsigned NOT NULL DEFAULT '0',
 `calendar_periodicity` int(10) unsigned DEFAULT NULL,
 `calendar_tolerance` int(10) unsigned NOT NULL DEFAULT '0',
 `activated` tinyint(1) unsigned NOT NULL DEFAULT '1',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `m_component_type_parentality` --

CREATE TABLE `m_component_type_parentality` (

 `m_component_type_id` int(10) unsigned NOT NULL,
 `m_component_type_parent_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`m_component_type_id`,`m_component_type_parent_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `m_history` --

CREATE TABLE `m_history` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `m_component_id` int(10) unsigned NOT NULL,
 `install_date` datetime DEFAULT NULL,
 `remove_date` datetime DEFAULT NULL,
 `total_hours_on_install` int(10) unsigned NOT NULL DEFAULT '0',
 `threshold_hours` int(10) unsigned NOT NULL DEFAULT '0',
 `threshold_date` datetime DEFAULT NULL,
 `threshold_date_locked` tinyint(1) unsigned NOT NULL DEFAULT '0',
 `threshold_hours_locked` tinyint(1) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `m_operation` --

CREATE TABLE `m_operation` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `content` text NOT NULL,
 `m_component_type_id` int(11) DEFAULT NULL,
 `order_num` int(11) NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `map_logger_monitoring` --

CREATE TABLE `map_logger_monitoring` (

 `record_id` int(10) unsigned NOT NULL,
 `count_data` int(10) unsigned NOT NULL,
 PRIMARY KEY (`record_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='link between flight and track';

-- -- Table structure for table `map_track` --

CREATE TABLE `map_track` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `record_id` int(10) unsigned DEFAULT NULL,
 `start_data` int(10) unsigned DEFAULT NULL,
 `number` int(10) unsigned DEFAULT NULL,
 `start_time` datetime DEFAULT NULL,
 `latitude_max` double DEFAULT NULL,
 `longitude_max` double DEFAULT NULL,
 `latitude_min` double DEFAULT NULL,
 `longitude_min` double DEFAULT NULL,
 `visible` tinyint(1) unsigned NOT NULL DEFAULT '1',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tracks split from GDR';

-- -- Table structure for table `nationality` --

CREATE TABLE `nationality` (

 `code` char(2) NOT NULL DEFAULT ,
 `label` varchar(255) NOT NULL,
 PRIMARY KEY (`code`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `parameter` --

CREATE TABLE `parameter` (

 `code` varchar(255) NOT NULL,
 `key_id` int(10) unsigned NOT NULL DEFAULT '0',
 `enabled` tinyint(1) unsigned DEFAULT '0',
 `int_value` int(10) unsigned DEFAULT '0',
 `char_value` text,
 PRIMARY KEY (`code`,`key_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='APPLICATION PARAMETERS';

-- -- Table structure for table `payment_distribution` --

CREATE TABLE `payment_distribution` (

 `payment_id` int(10) unsigned NOT NULL DEFAULT '0',
 `account_club_id` int(10) unsigned DEFAULT NULL,
 `person_delivery` tinyint(1) unsigned DEFAULT '0',
 `member_budget_id` int(10) unsigned DEFAULT NULL,
 `treasury_budget_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`payment_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='payment distribution description';

-- -- Table structure for table `payment_summary_file` --

CREATE TABLE `payment_summary_file` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `file_type` varchar(255) DEFAULT NULL,
 `content` longblob,
 `record_date` datetime DEFAULT NULL,
 `total_entry` int(10) unsigned DEFAULT NULL,
 `total_amount` decimal(15,5) unsigned DEFAULT NULL,
 `payment_type_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `payment_type` --

CREATE TABLE `payment_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` text,
 `text_field_label` text,
 `only_admin` tinyint(1) unsigned NOT NULL DEFAULT '0',
 `order_num` int(11) DEFAULT NULL,
 `pos_key_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='type of payment description';

-- -- Table structure for table `person` --

CREATE TABLE `person` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) NOT NULL,
 `hash_password` varchar(255) NOT NULL,
 `first_name` varchar(255) DEFAULT NULL,
 `last_name` varchar(255) DEFAULT NULL,
 `profile` bigint(20) unsigned DEFAULT NULL,
 `view_type` int(10) unsigned DEFAULT NULL,
 `view_width` tinyint(3) unsigned NOT NULL DEFAULT '12',
 `view_height` tinyint(4) unsigned NOT NULL DEFAULT '30',
 `email` varchar(255) DEFAULT NULL,
 `timezone` varchar(255) DEFAULT NULL,
 `address` varchar(255) DEFAULT NULL,
 `zipcode` varchar(255) DEFAULT NULL,
 `city` varchar(255) DEFAULT NULL,
 `state` varchar(255) DEFAULT NULL,
 `country` varchar(255) DEFAULT NULL,
 `home_phone` varchar(255) DEFAULT NULL,
 `work_phone` varchar(255) DEFAULT NULL,
 `cell_phone` varchar(255) DEFAULT NULL,
 `lang` varchar(255) DEFAULT NULL,
 `notification` tinyint(3) unsigned DEFAULT NULL,
 `activated` tinyint(1) unsigned DEFAULT '1',
 `birthdate` datetime DEFAULT '0000-00-00 00:00:00',
 `sex` tinyint(1) unsigned NOT NULL DEFAULT '0',
 `nationality` char(2) DEFAULT NULL,
 `total_flight_time` int(10) unsigned DEFAULT '0',
 `date_total_flight_time` datetime DEFAULT NULL,
 `aircrafts_viewed` varchar(255) DEFAULT NULL,
 `inst_viewed` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `idx_name` (`name`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='used for authentication';

-- -- Table structure for table `person_awaiting_activation` --

CREATE TABLE `person_awaiting_activation` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `login` varchar(255) NOT NULL,
 `ip` varchar(255) NOT NULL,
 `code` varchar(255) NOT NULL,
 `category` varchar(255) NOT NULL,
 `expiration_date` datetime DEFAULT NULL,
 `used` tinyint(1) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `product` --

CREATE TABLE `product` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `label` varchar(255) NOT NULL,
 `unit` varchar(255) NOT NULL,
 `free_sale` tinyint(1) NOT NULL DEFAULT '0',
 `locked` tinyint(1) unsigned DEFAULT '0',
 `variable_id` int(10) unsigned DEFAULT NULL,
 `sale_type` tinyint(1) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile` --

CREATE TABLE `profile` (

 `id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `name` varchar(255) DEFAULT NULL,
 `permits` int(10) unsigned DEFAULT NULL,
 `permits2` int(10) unsigned NOT NULL DEFAULT '0',
 `permits3` int(10) unsigned NOT NULL DEFAULT '0',
 `pictogram` int(10) unsigned DEFAULT NULL,
 `default_status_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_accounting_notification` --

CREATE TABLE `profile_accounting_notification` (

 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `accounting_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`profile_id`,`accounting_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_extra_field_join` --

CREATE TABLE `profile_extra_field_join` (

 `profile_id` bigint(20) unsigned NOT NULL,
 `extra_field_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`profile_id`,`extra_field_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_profile_view` --

CREATE TABLE `profile_profile_view` (

 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `viewable_profile_id` bigint(20) unsigned NOT NULL,
 PRIMARY KEY (`profile_id`,`viewable_profile_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_required_account_type` --

CREATE TABLE `profile_required_account_type` (

 `profile_id` bigint(20) unsigned NOT NULL,
 `account_type_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`profile_id`,`account_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_resource_type_place` --

CREATE TABLE `profile_resource_type_place` (

 `profile_id` bigint(20) unsigned NOT NULL,
 `resource_type_id` int(10) unsigned NOT NULL,
 `place_num` int(10) unsigned NOT NULL,
 PRIMARY KEY (`profile_id`,`resource_type_id`,`place_num`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_resource_type_view` --

CREATE TABLE `profile_resource_type_view` (

 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `viewable_resource_type_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`profile_id`,`viewable_resource_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_validity_type_join` --

CREATE TABLE `profile_validity_type_join` (

 `profile_id` bigint(20) unsigned NOT NULL,
 `validity_type_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`profile_id`,`validity_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `profile_validity_type_notification` --

CREATE TABLE `profile_validity_type_notification` (

 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `validity_type_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`profile_id`,`validity_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `psp_return` --

CREATE TABLE `psp_return` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `psp_transaction_id` int(10) unsigned DEFAULT NULL,
 `bank_answer` text,
 `bank_misc` text,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `psp_transaction` --

CREATE TABLE `psp_transaction` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `credit_account_id` int(10) unsigned NOT NULL,
 `debit_account_id` int(10) unsigned NOT NULL,
 `transaction_date` datetime NOT NULL,
 `amount` float NOT NULL,
 `description` varchar(255) DEFAULT NULL,
 `payment_type_id` int(10) unsigned NOT NULL,
 `state` int(10) unsigned NOT NULL DEFAULT '0',
 `token` text,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `psp_transaction_account_entry` --

CREATE TABLE `psp_transaction_account_entry` (

 `psp_transaction_id` int(10) unsigned NOT NULL DEFAULT '0',
 `account_entry_flow_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`psp_transaction_id`,`account_entry_flow_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `regular_presence_inst_date` --

CREATE TABLE `regular_presence_inst_date` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `person_id` int(10) unsigned DEFAULT NULL,
 `start_day` tinyint(3) unsigned DEFAULT NULL,
 `end_day` tinyint(3) unsigned DEFAULT NULL,
 `start_hour` time DEFAULT NULL,
 `end_hour` time DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `resource` --

CREATE TABLE `resource` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) DEFAULT NULL,
 `resource_type_id` int(10) unsigned DEFAULT NULL,
 `comments` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `activated` tinyint(1) unsigned NOT NULL DEFAULT '1',
 `bookable` int(10) unsigned DEFAULT '1',
 `physical` int(10) unsigned DEFAULT '1',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `resource_exceptional_availability` --

CREATE TABLE `resource_exceptional_availability` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `resource_id` int(10) unsigned DEFAULT NULL,
 `start_date` datetime DEFAULT NULL,
 `end_date` datetime DEFAULT NULL,
 `presence` tinyint(1) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `resource_regular_availability` --

CREATE TABLE `resource_regular_availability` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `resource_id` int(10) unsigned DEFAULT NULL,
 `start_day` tinyint(1) unsigned DEFAULT NULL,
 `end_day` tinyint(1) unsigned DEFAULT NULL,
 `start_hour` time DEFAULT NULL,
 `end_hour` time DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `resource_type` --

CREATE TABLE `resource_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) DEFAULT NULL,
 `category` int(10) unsigned DEFAULT NULL,
 `seats_available` int(11) DEFAULT '-1',
 `comments` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `activated` tinyint(1) unsigned NOT NULL DEFAULT '1',
 `max_booking_duration` int(10) DEFAULT '-1',
 `pictogram` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `resource_type_place_tag` --

CREATE TABLE `resource_type_place_tag` (

 `resource_type_id` int(10) unsigned NOT NULL,
 `place_num` tinyint(1) unsigned NOT NULL,
 `place_tag` varchar(255) DEFAULT NULL,
 `place_quantity` int(10) DEFAULT '-1',
 PRIMARY KEY (`resource_type_id`,`place_num`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `sale_2_stock` --

CREATE TABLE `sale_2_stock` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `product_id` int(10) unsigned NOT NULL,
 `stock_id` int(10) unsigned NOT NULL,
 `stock_variation_qty_per_sale` float NOT NULL DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `sale_2_validity_type` --

CREATE TABLE `sale_2_validity_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `validity_type_id` int(10) unsigned NOT NULL,
 `new_formula` varchar(255) DEFAULT NULL,
 `update_formula` varchar(255) DEFAULT NULL,
 `product_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `validity_type_id` (`validity_type_id`),
 UNIQUE KEY `validity_type_id_2` (`validity_type_id`),
 KEY `idx_product_id` (`product_id`),
 KEY `idx_product` (`product_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `sale_pricing` --

CREATE TABLE `sale_pricing` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `label` varchar(255) DEFAULT NULL,
 `price_formula` text,
 `debit_account_id` int(10) unsigned DEFAULT NULL,
 `credit_account_id` int(10) unsigned DEFAULT NULL,
 `debit_account_type` tinyint(1) unsigned DEFAULT '0',
 `credit_account_type` tinyint(1) unsigned DEFAULT '0',
 `credit_budget_id` int(10) unsigned DEFAULT NULL,
 `debit_budget_id` int(10) unsigned DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `variable_formula` varchar(255) DEFAULT NULL,
 `debit_bill_num` int(10) unsigned DEFAULT NULL,
 `credit_bill_num` int(10) unsigned DEFAULT NULL,
 `qty_formula` text,
 `unit_price_formula` text,
 `added_product_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `sale_pricing_product` --

CREATE TABLE `sale_pricing_product` (

 `sale_pricing_id` int(10) unsigned NOT NULL DEFAULT '0',
 `product_id` int(10) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`sale_pricing_id`,`product_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `sale_pricing_profile` --

CREATE TABLE `sale_pricing_profile` (

 `sale_pricing_id` int(10) unsigned NOT NULL,
 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`sale_pricing_id`,`profile_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `sale_trigger` --

CREATE TABLE `sale_trigger` (

 `id` int(10) NOT NULL DEFAULT '0',
 `name` varchar(255) DEFAULT NULL,
 `event` varchar(255) DEFAULT NULL,
 `locked` tinyint(1) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `spreadsheet_parameter` --

CREATE TABLE `spreadsheet_parameter` (

 `file_number` int(10) NOT NULL,
 `spreadsheet_key` varchar(255) NOT NULL,
 `spreadsheet_value` varchar(255) NOT NULL,
 `file_name` varchar(255) DEFAULT NULL,
 `google_url` varchar(255) NOT NULL,
 `file_type` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`file_number`,`spreadsheet_key`,`spreadsheet_value`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `statistic` --

CREATE TABLE `statistic` (

 `name` varchar(255) NOT NULL,
 `of_version` tinyint(3) NOT NULL DEFAULT '0',
 `value` decimal(15,2) DEFAULT '0.00',
 PRIMARY KEY (`name`,`of_version`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `status` --

CREATE TABLE `status` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `abbrev` varchar(255) DEFAULT NULL,
 `name` varchar(255) DEFAULT NULL,
 `pictogram` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of functions for pilot';

-- -- Table structure for table `stock` --

CREATE TABLE `stock` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `label` varchar(255) NOT NULL,
 `stock_type_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `stock_level` --

CREATE TABLE `stock_level` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `stock_id` int(10) unsigned NOT NULL,
 `qty` float NOT NULL DEFAULT '0',
 `stock_date` datetime DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `stock_type` --

CREATE TABLE `stock_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `label` varchar(255) NOT NULL,
 `unit` varchar(255) NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `stock_variation` --

CREATE TABLE `stock_variation` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `stock_id` int(10) unsigned NOT NULL,
 `qty` float NOT NULL DEFAULT '0',
 `variation_date` datetime DEFAULT NULL,
 `validated` tinyint(1) unsigned DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `stock_variation_account_entry` --

CREATE TABLE `stock_variation_account_entry` (

 `product_id` int(10) unsigned NOT NULL DEFAULT '0',
 `stock_variation_id` int(10) unsigned NOT NULL,
 `account_entry_flow_id` int(10) unsigned NOT NULL,
 `person_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`product_id`,`stock_variation_id`,`account_entry_flow_id`),
 KEY `idx_account_entry_flow_id` (`account_entry_flow_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `supplier_bill` --

CREATE TABLE `supplier_bill` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `supplier_bill_type_id` int(10) unsigned NOT NULL,
 `bill_date` date DEFAULT NULL,
 `description` varchar(255) DEFAULT NULL,
 `ordinal` int(10) unsigned NOT NULL,
 `validated` tinyint(1) DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `supplier_bill_account_entry` --

CREATE TABLE `supplier_bill_account_entry` (

 `supplier_bill_id` int(10) unsigned NOT NULL,
 `account_entry_flow_id` int(10) unsigned NOT NULL,
 PRIMARY KEY (`supplier_bill_id`,`account_entry_flow_id`),
 KEY `idx_account_entry_flow_id` (`account_entry_flow_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `supplier_bill_type` --

CREATE TABLE `supplier_bill_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `supplier_account_id` int(10) unsigned NOT NULL,
 `name` varchar(255) DEFAULT NULL,
 `account_id` int(10) unsigned NOT NULL,
 `vat_account_id` int(10) unsigned DEFAULT NULL,
 `supplier_budget_id` int(10) unsigned DEFAULT NULL,
 `account_budget_id` int(10) unsigned DEFAULT NULL,
 `vat_budget_id` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `table_trigger` --

CREATE TABLE `table_trigger` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `monitored_table` varchar(255) NOT NULL,
 `trigger_formula` varchar(255) NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `tank` --

CREATE TABLE `tank` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `aircraft_type_id` int(10) unsigned NOT NULL,
 `tank_type_id` int(10) unsigned NOT NULL,
 `unit_id` int(10) unsigned NOT NULL,
 `label` varchar(255) NOT NULL,
 `max_quantity` decimal(15,2) NOT NULL DEFAULT '-1.00',
 `unlimited_quantity` int(10) unsigned DEFAULT '1',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `track_record` --

CREATE TABLE `track_record` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `in_progress` tinyint(1) unsigned DEFAULT NULL,
 `start_date` datetime DEFAULT '0000-00-00 00:00:00',
 `activated` tinyint(1) unsigned DEFAULT NULL,
 `datechsys_track_id` int(10) unsigned DEFAULT NULL,
 `resource_cat` int(10) unsigned NOT NULL,
 `resource_id` int(10) unsigned NOT NULL,
 `additional_information` int(10) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `track_record_data` --

CREATE TABLE `track_record_data` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `record_id` int(10) unsigned NOT NULL,
 `record_date` datetime DEFAULT NULL,
 `longitude` double DEFAULT NULL,
 `latitude` double DEFAULT NULL,
 `altitude` int(7) DEFAULT NULL,
 `speed` double DEFAULT NULL,
 `track` int(3) unsigned DEFAULT NULL,
 `acc_x` int(6) DEFAULT NULL,
 `acc_y` int(6) DEFAULT NULL,
 `acc_z` int(6) DEFAULT NULL,
 `pressure` int(5) unsigned DEFAULT NULL,
 `battery_level` int(4) unsigned DEFAULT NULL,
 `gps_fix` tinyint(1) unsigned DEFAULT NULL,
 `receive_date` datetime DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `idx_record_id` (`record_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `track_resource` --

CREATE TABLE `track_resource` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `uncomp_flight_type` --

CREATE TABLE `uncomp_flight_type` (

 `id1` int(10) unsigned DEFAULT NULL,
 `id2` int(10) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='List of sales';

-- -- Table structure for table `validity` --

CREATE TABLE `validity` (

 `person_id` int(10) unsigned NOT NULL,
 `validity_type_id` int(10) unsigned NOT NULL,
 `expire_date` date DEFAULT NULL,
 `no_alert` tinyint(1) unsigned NOT NULL DEFAULT '0',
 `ident_value` varchar(255) DEFAULT NULL,
 `grant_date` date DEFAULT NULL,
 PRIMARY KEY (`person_id`,`validity_type_id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='QUALIFICATIONS OF EACH MEMBER';

-- -- Table structure for table `validity_type` --

CREATE TABLE `validity_type` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) NOT NULL,
 `time_limitation` tinyint(1) NOT NULL DEFAULT '0',
 `ident_value_enable` tinyint(1) NOT NULL DEFAULT '0',
 `grant_date_enable` tinyint(1) NOT NULL DEFAULT '0',
 `mandatory` tinyint(1) NOT NULL DEFAULT '0',
 `experience_formula` varchar(255) DEFAULT NULL,
 `alert_on_login` int(11) DEFAULT '-2',
 `mandatory_access_control` tinyint(1) unsigned DEFAULT '0',
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='QUALIFICATIONS LIST';

-- -- Table structure for table `variable` --

CREATE TABLE `variable` (

 `id` int(11) NOT NULL AUTO_INCREMENT,
 `variable` varchar(255) NOT NULL,
 `label` varchar(255) NOT NULL,
 `category` tinyint(1) DEFAULT NULL,
 `value_type` varchar(255) DEFAULT NULL,
 `order_num` int(11) NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `variable_value` --

CREATE TABLE `variable_value` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `variable_id` int(11) NOT NULL,
 `assign_value` decimal(15,2) NOT NULL,
 `start_date` datetime NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `web_feed` --

CREATE TABLE `web_feed` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `channel_id` int(10) unsigned NOT NULL,
 `publication_date` datetime NOT NULL,
 `title` varchar(255) DEFAULT NULL,
 `content` text,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Table structure for table `web_feed_channel` --

CREATE TABLE `web_feed_channel` (

 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `label` varchar(255) NOT NULL,
 PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1;</sql>