Database OF35

From OpenFlyers Documentation
Jump to navigation Jump to search

<syntaxhighlight lang="sql">CREATE TABLE `account` ( `id` int(10) unsigned NOT NULL,

 `creation_date` date DEFAULT NULL,
 `name` text,
 `export_account` varchar(255) DEFAULT NULL,
 `activated` tinyint(1) 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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `accounting` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `accounting_profile` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `account_entry` ( `id` int(11) NOT NULL,

 `flow_id` int(11) DEFAULT NULL,
 `account_date` datetime DEFAULT NULL,
 `registration_date` datetime DEFAULT NULL,
 `account_id` int(11) DEFAULT NULL,
 `credit` decimal(15,5) DEFAULT '0.00000',
 `debit` decimal(15,5) 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',
 `budget_id` int(10) unsigned DEFAULT NULL,
 `product_id` int(10) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `account_type` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `account_type_profile` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `aircraft` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `aircraft_type` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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;

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;

CREATE TABLE `aircraft_type_validity_type` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `balance` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `balance_date` ( `id` int(10) unsigned NOT NULL,

 `balance_date` datetime DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `booking` ( `id` int(10) unsigned NOT NULL,

 `start_date` datetime DEFAULT NULL,
 `end_date` datetime DEFAULT NULL,
 `resource_id` int(10) unsigned DEFAULT NULL,
 `person_id` int(10) unsigned DEFAULT NULL,
 `slot_type` tinyint(3) unsigned DEFAULT NULL,
 `instructor_id` int(10) unsigned DEFAULT NULL,
 `free_seats` int(10) unsigned DEFAULT NULL,
 `departure_location_id` int(10) unsigned DEFAULT NULL,
 `arrival_location_id` int(10) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `budget` ( `id` int(10) unsigned NOT NULL,

 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `budget_group` ( `id` int(10) unsigned NOT NULL,

 `name` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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 NOT NULL DEFAULT '0',
 `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) DEFAULT NULL,
 `lang` varchar(255) DEFAULT NULL,
 `admin_num` int(10) unsigned NOT NULL,
 `mail_from_address` varchar(255) DEFAULT 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` tinyint(3) unsigned DEFAULT NULL,
 `welcome_cell` text

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `criteria` ( `id` int(11) NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `criteria_profile` (

 `criteria_id` int(10) unsigned NOT NULL,
 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `customer_bill_entry` ( `id` int(10) unsigned NOT NULL,

 `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,2) DEFAULT '0.00',
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `customer_bill_file` ( `id` int(10) unsigned NOT NULL,

 `file_type` varchar(255) DEFAULT NULL,
 `content` longblob

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `default_display` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `default_multi_display` (

 `resource_type` char(30) NOT NULL,
 `person_id` int(10) unsigned NOT NULL DEFAULT '0',
 `resource_id` int(10) unsigned NOT NULL,
 `display_value` text

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `exceptionnal_inst_date` (

 `person_id` int(10) unsigned DEFAULT NULL,
 `start_date` datetime DEFAULT NULL,
 `end_date` datetime DEFAULT NULL,
 `presence` tinyint(1) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `extra_field` ( `id` int(10) unsigned NOT NULL,

 `variable` varchar(255) DEFAULT NULL,
 `label` varchar(255) DEFAULT NULL,
 `value_type` varchar(40) DEFAULT NULL,
 `category` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL,
 `dsn` varchar(20) DEFAULT NULL,
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `extra_field_content` (

 `category_id` int(10) unsigned NOT NULL,
 `extra_field_id` int(10) unsigned NOT NULL,
 `content` text

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `facebook` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `favorite_icao` (

 `icao` varchar(6) NOT NULL DEFAULT 

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `fhp_aircraft_type` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `file` ( `id` int(10) unsigned NOT NULL,

 `name` varchar(255) DEFAULT NULL,
 `content` mediumblob,
 `file_type` varchar(255) DEFAULT NULL,
 `category` tinyint(1) unsigned DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight` ( `id` int(10) unsigned NOT NULL,

 `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,
 `comments` varchar(255) DEFAULT NULL,
 `airborne` tinyint(1) unsigned DEFAULT NULL,
 `validated` tinyint(3) unsigned DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight_account_entry` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight_hours_pricing` ( `id` int(10) unsigned NOT NULL,

 `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 NULL,
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight_pilot` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight_tank_qty` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight_track` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight_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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `flight_type_mandatory_validity_type` (

 `flight_type_id` int(10) unsigned NOT NULL,
 `validity_type_id` int(10) unsigned NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `import` ( `id` int(10) unsigned NOT NULL,

 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ip_stopped` ( `id` int(10) unsigned NOT NULL,

 `ip` varchar(255) DEFAULT NULL,
 `counter` tinyint(1) unsigned NOT NULL,
 `expire_date` datetime NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `journal` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `key_alert` ( `id` int(10) unsigned NOT NULL,

 `alert_date` datetime DEFAULT NULL,
 `STATUS` int(10) unsigned NOT NULL DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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 NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `key_host` ( `id` tinyint(2) NOT NULL,

 `timeout` tinyint(2) unsigned NOT NULL DEFAULT '10',
 `num_key` tinyint(2) unsigned NOT NULL DEFAULT '8',
 `ipkey` varchar(50) DEFAULT NULL,
 `httpport` varchar(4) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `key_log` ( `id` int(10) unsigned NOT NULL,

 `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 NOT NULL,
 `error` varchar(255) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `location` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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` text

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `logger` ( `id` int(10) unsigned NOT NULL,

 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `login_stopped` ( `id` int(10) unsigned NOT NULL,

 `login` varchar(255) DEFAULT NULL,
 `counter` tinyint(3) unsigned NOT NULL,
 `expire_date` datetime NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `map_logger_monitoring` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `map_track` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `m_component` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `m_component_type` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `m_history` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `m_operation` ( `id` int(10) unsigned NOT NULL,

 `content` text,
 `m_component_type_id` int(10) unsigned NOT NULL,
 `order_num` int(11) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `nationality` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `parameter` (

 `code` varchar(255) NOT NULL DEFAULT ,
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `payment_distribution` (

 `payment_id` int(10) unsigned DEFAULT NULL,
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `payment_type` ( `id` int(10) unsigned NOT NULL,

 `name` text,
 `text_field_label` text,
 `supplier` varchar(255) DEFAULT NULL,
 `only_admin` tinyint(1) unsigned NOT NULL DEFAULT '0',
 `order_num` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `person` ( `id` int(10) unsigned NOT NULL,

 `name` varchar(255) DEFAULT NULL,
 `hash_password` varchar(255) NOT NULL,
 `first_name` varchar(255) DEFAULT NULL,
 `last_name` varchar(255) DEFAULT NULL,
 `profile` bigint(20) unsigned NOT NULL DEFAULT '0',
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `person_awaiting_activation` ( `id` int(10) unsigned NOT NULL,

 `login` varchar(255) DEFAULT NULL,
 `ip` varchar(255) DEFAULT NULL,
 `code` varchar(255) DEFAULT NULL,
 `category` varchar(255) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `product` ( `id` int(10) unsigned NOT NULL,

 `label` varchar(255) DEFAULT NULL,
 `unit` varchar(255) DEFAULT 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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `profile_extra_field_join` (

 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `extra_field_id` int(10) unsigned NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `profile_profile_view` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `profile_required_account_type` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `profile_resource_type_place` (

 `profile_id` bigint(20) unsigned NOT NULL DEFAULT '0',
 `resource_type_id` int(10) unsigned NOT NULL,
 `place_num` int(10) unsigned NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `profile_resource_type_view` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `profile_validity_type_join` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `profile_validity_type_notification` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `psp_return` ( `id` int(10) unsigned NOT NULL,

 `psp_transaction_id` int(10) unsigned DEFAULT NULL,
 `bank_answer` text,
 `bank_misc` text

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `psp_transaction` ( `id` int(10) unsigned NOT NULL,

 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `regular_presence_inst_date` (

 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `resource` ( `id` int(10) unsigned NOT NULL,

 `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',
 `non_bookable` tinyint(1) unsigned NOT NULL DEFAULT '0',
 `virtual` tinyint(10) unsigned DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `resource_type` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sale_2_stock` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sale_2_validity_type` ( `id` int(10) unsigned NOT NULL,

 `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 DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sale_pricing` ( `id` int(10) unsigned NOT NULL,

 `label` varchar(255) DEFAULT NULL,
 `price_formula` text,
 `debit_account_id` int(10) unsigned NOT NULL,
 `credit_account_id` int(10) unsigned NOT NULL,
 `debit_account_type` int(10) unsigned NOT NULL,
 `credit_account_type` int(10) unsigned NOT NULL,
 `debit_budget_id` int(10) unsigned DEFAULT NULL,
 `credit_budget_id` int(10) unsigned DEFAULT NULL,
 `order_num` int(10) 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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sale_pricing_product` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sale_pricing_profile` (

 `sale_pricing_id` int(10) unsigned NOT NULL,
 `profile_id` int(10) unsigned NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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 DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `statistic` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `status` ( `id` int(10) unsigned NOT NULL,

 `abbrev` varchar(255) DEFAULT NULL,
 `name` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `stock` ( `id` int(10) unsigned NOT NULL,

 `label` varchar(255) DEFAULT NULL,
 `stock_type_id` int(10) unsigned NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `stock_level` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `stock_type` ( `id` int(10) unsigned NOT NULL,

 `label` varchar(255) DEFAULT NULL,
 `unit` varchar(255) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `stock_variation` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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 DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `supplier_bill` ( `id` int(10) unsigned NOT NULL,

 `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'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `supplier_bill_account_entry` (

 `supplier_bill_id` int(10) unsigned NOT NULL,
 `account_entry_flow_id` int(10) unsigned NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `supplier_bill_type` ( `id` int(10) unsigned NOT NULL,

 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `tank` ( `id` int(10) unsigned NOT NULL,

 `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) DEFAULT NULL,
 `max_quantity` decimal(15,2) DEFAULT '-1.00'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `track_record` ( `id` int(10) unsigned NOT NULL,

 `box_id` int(10) unsigned DEFAULT '0',
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `track_record_data` ( `id` int(10) unsigned NOT NULL,

 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `uncomp_flight_type` (

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `validity` (

 `person_id` int(10) unsigned NOT NULL DEFAULT '0',
 `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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `validity_type` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `variable` ( `id` int(11) NOT NULL,

 `variable` varchar(255) DEFAULT NULL,
 `label` varchar(255) DEFAULT NULL,
 `category` tinyint(1) unsigned NOT NULL,
 `value_type` varchar(255) DEFAULT NULL,
 `order_num` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `variable_value` ( `id` int(11) NOT NULL,

 `variable_id` int(11) NOT NULL,
 `assign_value` decimal(15,2) DEFAULT '0.00',
 `start_date` datetime NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `web_feed` ( `id` int(10) unsigned NOT NULL,

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

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `web_feed_channel` ( `id` int(10) unsigned NOT NULL,

 `label` varchar(255) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;


ALTER TABLE `account`

ADD PRIMARY KEY (`id`), ADD KEY `idx_owner_id` (`owner_id`);

ALTER TABLE `accounting`

ADD PRIMARY KEY (`id`);

ALTER TABLE `accounting_profile`

ADD PRIMARY KEY (`accounting_id`,`profile_id`);

ALTER TABLE `account_entry`

ADD PRIMARY KEY (`id`), ADD KEY `idx_account_date` (`account_date`), ADD KEY `idx_flow_id` (`flow_id`);

ALTER TABLE `account_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `account_type_profile`

ADD PRIMARY KEY (`account_type_id`,`profile_id`);

ALTER TABLE `aircraft`

ADD PRIMARY KEY (`id`);

ALTER TABLE `aircraft_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `aircraft_type_validity_type`

ADD PRIMARY KEY (`aircraft_type_id`,`validity_type_id`,`check_num`);

ALTER TABLE `balance`

ADD PRIMARY KEY (`account_id`,`balance_date_id`);

ALTER TABLE `balance_date`

ADD PRIMARY KEY (`id`);

ALTER TABLE `booking`

ADD PRIMARY KEY (`id`);

ALTER TABLE `booking_account_entry`

ADD PRIMARY KEY (`booking_id`,`account_entry_flow_id`);

ALTER TABLE `budget`

ADD PRIMARY KEY (`id`);

ALTER TABLE `budget_group`

ADD PRIMARY KEY (`id`);

ALTER TABLE `club`

ADD PRIMARY KEY (`id`);

ALTER TABLE `criteria`

ADD PRIMARY KEY (`id`);

ALTER TABLE `criteria_profile`

ADD PRIMARY KEY (`criteria_id`,`profile_id`);

ALTER TABLE `customer_bill_entry`

ADD PRIMARY KEY (`id`), ADD KEY `idx_account_entry_id` (`account_entry_id`), ADD KEY `idx_account_entry_flow_id` (`account_entry_flow_id`);

ALTER TABLE `customer_bill_file`

ADD PRIMARY KEY (`id`);

ALTER TABLE `default_display`

ADD PRIMARY KEY (`person_id`,`display_key`);

ALTER TABLE `default_multi_display`

ADD PRIMARY KEY (`resource_type`,`person_id`,`resource_id`);

ALTER TABLE `extra_field`

ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `variable` (`variable`);

ALTER TABLE `extra_field_content`

ADD PRIMARY KEY (`category_id`,`extra_field_id`);

ALTER TABLE `extra_field_profile`

ADD PRIMARY KEY (`extra_field_id`,`booking_popup_display_4_profile_id`);

ALTER TABLE `facebook`

ADD PRIMARY KEY (`id`);

ALTER TABLE `favorite_icao`

ADD PRIMARY KEY (`icao`);

ALTER TABLE `fhp_aircraft_type`

ADD PRIMARY KEY (`fhp_id`,`aircraft_type_id`);

ALTER TABLE `fhp_flight_type`

ADD PRIMARY KEY (`fhp_id`,`flight_type_id`);

ALTER TABLE `fhp_profile`

ADD PRIMARY KEY (`fhp_id`,`profile_id`,`place_num`);

ALTER TABLE `file`

ADD PRIMARY KEY (`id`);

ALTER TABLE `flight`

ADD PRIMARY KEY (`id`);

ALTER TABLE `flight_account_entry`

ADD PRIMARY KEY (`flight_id`,`account_entry_id`), ADD KEY `idx_account_entry_id` (`account_entry_id`);

ALTER TABLE `flight_hours_pricing`

ADD PRIMARY KEY (`id`);

ALTER TABLE `flight_pilot`

ADD PRIMARY KEY (`flight_id`,`pilot_id`,`num`);

ALTER TABLE `flight_tank_qty`

ADD PRIMARY KEY (`id`);

ALTER TABLE `flight_track`

ADD PRIMARY KEY (`track_id`,`flight_id`);

ALTER TABLE `flight_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `flight_type_mandatory_validity_type`

ADD PRIMARY KEY (`flight_type_id`,`validity_type_id`);

ALTER TABLE `import`

ADD PRIMARY KEY (`id`);

ALTER TABLE `ip_stopped`

ADD PRIMARY KEY (`id`);

ALTER TABLE `journal`

ADD PRIMARY KEY (`id`), ADD KEY `idx_date_log` (`date_log`), ADD KEY `idx_action` (`action`(8));

ALTER TABLE `key_alert`

ADD PRIMARY KEY (`id`);

ALTER TABLE `key_assignment`

ADD PRIMARY KEY (`key_id`);

ALTER TABLE `key_host`

ADD PRIMARY KEY (`id`);

ALTER TABLE `key_log`

ADD PRIMARY KEY (`id`);

ALTER TABLE `location`

ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `icao_name` (`icao_name`);

ALTER TABLE `log`

ADD KEY `journal_id` (`journal_id`);

ALTER TABLE `logger`

ADD PRIMARY KEY (`id`);

ALTER TABLE `login_stopped`

ADD PRIMARY KEY (`id`);

ALTER TABLE `map_logger_monitoring`

ADD PRIMARY KEY (`record_id`);

ALTER TABLE `map_track`

ADD PRIMARY KEY (`id`);

ALTER TABLE `m_component`

ADD PRIMARY KEY (`id`);

ALTER TABLE `m_component_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `m_component_type_parentality`

ADD PRIMARY KEY (`m_component_type_id`,`m_component_type_parent_id`);

ALTER TABLE `m_history`

ADD PRIMARY KEY (`id`);

ALTER TABLE `m_operation`

ADD PRIMARY KEY (`id`);

ALTER TABLE `nationality`

ADD PRIMARY KEY (`code`);

ALTER TABLE `parameter`

ADD PRIMARY KEY (`code`,`key_id`);

ALTER TABLE `payment_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `person`

ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `idx_name` (`name`);

ALTER TABLE `person_awaiting_activation`

ADD PRIMARY KEY (`id`);

ALTER TABLE `product`

ADD PRIMARY KEY (`id`);

ALTER TABLE `profile`

ADD PRIMARY KEY (`id`);

ALTER TABLE `profile_extra_field_join`

ADD PRIMARY KEY (`profile_id`,`extra_field_id`);

ALTER TABLE `profile_profile_view`

ADD PRIMARY KEY (`profile_id`,`viewable_profile_id`);

ALTER TABLE `profile_required_account_type`

ADD PRIMARY KEY (`profile_id`,`account_type_id`);

ALTER TABLE `profile_resource_type_place`

ADD PRIMARY KEY (`profile_id`,`resource_type_id`,`place_num`);

ALTER TABLE `profile_resource_type_view`

ADD PRIMARY KEY (`profile_id`,`viewable_resource_type_id`);

ALTER TABLE `profile_validity_type_join`

ADD PRIMARY KEY (`profile_id`,`validity_type_id`);

ALTER TABLE `profile_validity_type_notification`

ADD PRIMARY KEY (`profile_id`,`validity_type_id`);

ALTER TABLE `psp_return`

ADD PRIMARY KEY (`id`);

ALTER TABLE `psp_transaction`

ADD PRIMARY KEY (`id`);

ALTER TABLE `resource`

ADD PRIMARY KEY (`id`);

ALTER TABLE `resource_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `resource_type_place_tag`

ADD PRIMARY KEY (`resource_type_id`,`place_num`);

ALTER TABLE `sale_2_stock`

ADD PRIMARY KEY (`id`);

ALTER TABLE `sale_2_validity_type`

ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `validity_type_id` (`validity_type_id`), ADD KEY `idx_product` (`product_id`);

ALTER TABLE `sale_pricing`

ADD PRIMARY KEY (`id`);

ALTER TABLE `sale_pricing_product`

ADD PRIMARY KEY (`sale_pricing_id`,`product_id`);

ALTER TABLE `sale_pricing_profile`

ADD PRIMARY KEY (`sale_pricing_id`,`profile_id`);

ALTER TABLE `sale_trigger`

ADD PRIMARY KEY (`id`);

ALTER TABLE `statistic`

ADD PRIMARY KEY (`name`,`of_version`);

ALTER TABLE `status`

ADD PRIMARY KEY (`id`);

ALTER TABLE `stock`

ADD PRIMARY KEY (`id`);

ALTER TABLE `stock_level`

ADD PRIMARY KEY (`id`);

ALTER TABLE `stock_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `stock_variation`

ADD PRIMARY KEY (`id`);

ALTER TABLE `stock_variation_account_entry`

ADD PRIMARY KEY (`product_id`,`stock_variation_id`,`account_entry_flow_id`), ADD KEY `idx_account_entry_flow_id` (`account_entry_flow_id`);

ALTER TABLE `supplier_bill`

ADD PRIMARY KEY (`id`);

ALTER TABLE `supplier_bill_account_entry`

ADD PRIMARY KEY (`supplier_bill_id`,`account_entry_flow_id`), ADD KEY `idx_account_entry_flow_id` (`account_entry_flow_id`);

ALTER TABLE `supplier_bill_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `tank`

ADD PRIMARY KEY (`id`);

ALTER TABLE `track_record`

ADD PRIMARY KEY (`id`), ADD KEY `idx_box_id` (`box_id`);

ALTER TABLE `track_record_data`

ADD PRIMARY KEY (`id`), ADD KEY `idx_record_id` (`record_id`);

ALTER TABLE `validity`

ADD PRIMARY KEY (`person_id`,`validity_type_id`);

ALTER TABLE `validity_type`

ADD PRIMARY KEY (`id`);

ALTER TABLE `variable`

ADD PRIMARY KEY (`id`);

ALTER TABLE `variable_value`

ADD PRIMARY KEY (`id`);

ALTER TABLE `web_feed`

ADD PRIMARY KEY (`id`);

ALTER TABLE `web_feed_channel`

ADD PRIMARY KEY (`id`);


ALTER TABLE `account` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `accounting` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `account_entry` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; ALTER TABLE `account_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `balance_date` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `booking` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `budget` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `budget_group` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `criteria` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; ALTER TABLE `customer_bill_entry` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `customer_bill_file` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `extra_field` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `facebook` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `file` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `flight` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `flight_hours_pricing` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `flight_tank_qty` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `import` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `ip_stopped` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `journal` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `key_alert` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `key_host` MODIFY `id` tinyint(2) NOT NULL AUTO_INCREMENT; ALTER TABLE `key_log` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `location` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `logger` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `login_stopped` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `map_track` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `m_component` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `m_component_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `m_history` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `m_operation` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `payment_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `person` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `person_awaiting_activation` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `product` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `psp_return` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `psp_transaction` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `resource` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `resource_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `sale_2_stock` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `sale_2_validity_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `sale_pricing` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `status` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `stock` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `stock_level` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `stock_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `stock_variation` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `supplier_bill` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `supplier_bill_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `tank` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `track_record` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `track_record_data` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `validity_type` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `variable` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; ALTER TABLE `variable_value` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; ALTER TABLE `web_feed` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; ALTER TABLE `web_feed_channel` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;</sql>