-- Copyright (C) ---Put here your own copyright and developer email---
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see https://www.gnu.org/licenses/.


CREATE TABLE llx_fleetmanagment_vehicle(
	-- BEGIN MODULEBUILDER FIELDS
	rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, 
	ref varchar(128) NOT NULL,
	label varchar(255),
	num_serie varchar(255),
	power double(24,8),
	power_dyn double(24,8), 
	kilometrage double(24,8), 
	engine_size double(24,8), 
	fk_soc_buy integer, 
	fk_soc_sell integer, 
	imatriculation varchar(255) NOT NULL, 
	modele integer, 
	marque integer, 
	carburant integer, 
	type integer, 
	buy_price double, 
	sell_price double, 
	nbPlaces integer, 
	CO2_emission integer, 
	poids_a_vide integer, 
	poids_net integer, 
	boite_de_vitesses varchar(255), 
	taille_pneu_avant varchar(255), 
	taille_pneu_arriere varchar(255), 
	hybride varchar(255), 
	categorie_hybride varchar(255), 
	garantie_constructeur varchar(255), 
	carrosserie_couleur varchar(255), 
	cnit varchar(255), 
	publish integer, 
	publish_date timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 
	description text, 
	note_public text, 
	note_private text, 
	first_inscription date, 
	next_ct_periodique date, 
	date_desinscription date, 
	date_enregistrement date, 
	date_creation datetime NOT NULL, 
	tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 
	fk_user_creat integer NOT NULL, 
	fk_user_modif integer, 
	fk_order varchar(14), 
	fk_order_fourn varchar(14), 
	import_key varchar(14), 
	status integer NOT NULL
	-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

ALTER TABLE llx_fleetmanagment_vehicle ADD cnit varchar(255);
ALTER TABLE llx_fleetmanagment_vehicle ADD fk_order_fourn varchar(14);
ALTER TABLE llx_fleetmanagment_vehicle ADD fk_soc integer;