Fix: Gestion des types tinyint et datetime.

This commit is contained in:
Laurent Destailleur 2005-03-01 20:38:51 +00:00
parent a9eedc8f33
commit 16cd9c2a90
97 changed files with 227 additions and 180 deletions

View File

@ -156,6 +156,7 @@ foreach my $file (keys %filelist) {
&reset_vars();
next;
}
if (/(\w*)\s+enum\(((?:['"]\w+['"]\s*,)+['"]\w+['"])\)(.*)$/i) { # enum handling
$enum_column=$1;
$enum_datafield{$enum_column} = $2; # 'abc','def', ...
@ -184,12 +185,17 @@ foreach my $file (keys %filelist) {
}
s/\w*int\(\d+\)/$out/g;
}
elsif (/tinyint/i) {
s/tinyint/smallint/g;
}
# nuke int unsigned
s/(int\w+)\s+unsigned/$1/gi;
# blob -> text
s/\w*blob/text/gi;
# tinytext/mediumtext -> text
s/tinytext/text/gi;
s/mediumtext/text/gi;
@ -207,6 +213,7 @@ foreach my $file (keys %filelist) {
# change not null datetime field to null valid ones
# (to support remapping of "zero time" to null
s/datetime not null/datetime/i;
s/datetime/timestamp/i;
# nuke size of timestamp
s/timestamp\([^)]*\)/timestamp/i;
@ -215,12 +222,12 @@ foreach my $file (keys %filelist) {
s/double\([^)]*\)/float8/i;
# add unique to definition of type (MySQL separates this)
if (/unique \w+ \((\w+)\)/i) {
$create_sql.=~s/($1)([^,]+)/$1$2 unique/i;
next;
}
# if (/unique \w+ \((\w+)\)/i) {
# $create_sql.=~s/($1)([^,]+)/$1$2 unique/i;
# next;
# }
# FIX: unique for multipe columns (col1,col2) are unsupported!
next if (/unique/i);
# next if (/unique/i);
if (/\bkey\b/i && !/^\s+primary key\s+/i) {
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key

View File

@ -37,8 +37,8 @@ create table llx_adherent
"public" smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ?
"fk_adherent_type" smallint,
"morphy" varchar(3) CHECK (morphy IN ('mor','phy')) NOT NULL, -- personne morale / personne physique
"datevalid" datetime, -- date de validation
"datec" datetime, -- date de creation
"datevalid" timestamp, -- date de validation
"datec" timestamp, -- date de creation
"prenom" varchar(50),
"nom" varchar(50),
"societe" varchar(50),
@ -54,7 +54,8 @@ create table llx_adherent
"fk_user_author" integer NOT NULL,
"fk_user_mod" integer NOT NULL,
"fk_user_valid" integer NOT NULL,
"datefin" datetime, -- date de fin de validité de la cotisation
"datefin" timestamp, -- date de fin de validité de la cotisation
"note" text,
"UNIQUE" INDEX(login)
);

View File

@ -33,4 +33,5 @@ create table llx_adherent_options
optid SERIAL PRIMARY KEY,
"tms" timestamp,
"adhid" integer NOT NULL, -- id de l'adherent auquel correspond ces attributs optionnel
"UNIQUE" INDEX(adhid)
);

View File

@ -33,7 +33,7 @@ create table llx_album
"title" varchar(64),
"annee" int2,
"description" text,
"collectif" tinyint,
"collectif" smallint,
"fk_user_author" integer
);

View File

@ -28,6 +28,7 @@
create table llx_album_to_groupart
(
"fk_album" integer NOT NULL,
"fk_groupart" integer NOT NULL
"fk_groupart" integer NOT NULL,
unique key(fk_album, fk_groupart)
);

View File

@ -27,7 +27,7 @@
create table llx_appro
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"fk_product" integer NOT NULL,
"quantity" smallint unsigned NOT NULL,

View File

@ -29,7 +29,7 @@
create table llx_bank
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"datev" date, -- date de valeur
"dateo" date, -- date operation
"amount" real NOT NULL default 0,
@ -40,7 +40,7 @@ create table llx_bank
"fk_type" varchar(4), -- CB, Virement, cheque
"num_releve" varchar(50),
"num_chq" int,
"rappro" tinyint default 0,
"rappro" smallint default 0,
"note" text,
"author" varchar(40) -- a supprimer apres migration
);

View File

@ -32,7 +32,7 @@
create table llx_bank_account
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"label" varchar(30),
"bank" varchar(60),

View File

@ -27,5 +27,5 @@ create table llx_bookmark
rowid SERIAL PRIMARY KEY,
"fk_soc" integer,
"fk_user" integer,
"dateb" datetime
"dateb" timestamp
);

View File

@ -29,5 +29,6 @@ create table llx_bookmark4u_login
(
rowid SERIAL PRIMARY KEY,
"fk_user" integer,
"bk4u_uid" integer
"bk4u_uid" integer,
"UNIQUE" INDEX(fk_user)
);

View File

@ -28,8 +28,9 @@
create table llx_c_actioncomm
(
id integer PRIMARY KEY,
"code" varchar(12) UNIQUE NOT NULL,
"type" varchar(10) DEFAULT 'system' NOT NULL,
"libelle" varchar(30) NOT NULL,
"active" tinyint DEFAULT 1 NOT NULL,
"todo" tinyint
"active" smallint DEFAULT 1 NOT NULL,
"todo" smallint
);

View File

@ -30,6 +30,6 @@ create table llx_c_ape
rowid SERIAL PRIMARY KEY,
code_ape varchar(5) PRIMARY KEY,
"libelle" varchar(255),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -30,7 +30,7 @@ create table llx_c_chargesociales
id integer PRIMARY KEY,
"libelle" varchar(80),
"deductible" smallint DEFAULT 0 NOT NULL,
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -27,7 +27,8 @@
create table llx_c_civilite
(
rowid integer PRIMARY KEY,
"code" varchar(6) UNIQUE NOT NULL,
"civilite" varchar(50),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -26,7 +26,9 @@
create table llx_c_currencies
(
code varchar(2) UNIQUE PRIMARY KEY,
"code_iso" varchar(3) UNIQUE NOT NULL,
"label" varchar(64),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -35,7 +35,7 @@ create table llx_c_departements
"tncc" integer,
"ncc" varchar(50),
"nom" varchar(50),
"active" tinyint DEFAULT 1 NOT NULL,
"active" smallint DEFAULT 1 NOT NULL,
key (fk_region)
);

View File

@ -28,7 +28,8 @@
create table llx_c_effectif
(
id integer PRIMARY KEY,
"code" varchar(12) UNIQUE NOT NULL,
"libelle" varchar(30),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -29,8 +29,9 @@
create table llx_c_forme_juridique
(
rowid SERIAL PRIMARY KEY,
"code" varchar(12) UNIQUE NOT NULL,
"fk_pays" integer NOT NULL,
"libelle" varchar(255),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -30,6 +30,6 @@ create table llx_c_methode_commande_fournisseur
rowid SERIAL PRIMARY KEY,
"code" varchar(30),
"libelle" varchar(30),
"active" tinyint default 1 NOT NULL
"active" smallint default 1 NOT NULL
);

View File

@ -34,9 +34,10 @@
create table llx_c_paiement
(
id integer PRIMARY KEY,
"code" varchar(6) UNIQUE NOT NULL,
"libelle" varchar(30),
"type" smallint,
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -28,8 +28,9 @@
create table llx_c_pays
(
rowid integer PRIMARY KEY,
"code" varchar(6) UNIQUE NOT NULL,
"libelle" varchar(25) NOT NULL,
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -28,7 +28,8 @@
create table llx_c_propalst
(
id smallint PRIMARY KEY,
"code" varchar(12) UNIQUE NOT NULL,
"label" varchar(30),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -28,10 +28,11 @@
create table llx_c_regions
(
rowid SERIAL PRIMARY KEY,
"code_region" integer UNIQUE NOT NULL,
"fk_pays" integer NOT NULL,
"cheflieu" varchar(7),
"tncc" integer,
"nom" varchar(50),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -28,7 +28,8 @@
create table llx_c_stcomm
(
id integer PRIMARY KEY,
"code" varchar(12) UNIQUE NOT NULL,
"libelle" varchar(30),
"active" tinyint default 1 NOT NULL
"active" smallint default 1 NOT NULL
);

View File

@ -28,6 +28,7 @@
create table llx_c_typent
(
id integer PRIMARY KEY,
"code" varchar(12) UNIQUE NOT NULL,
"libelle" varchar(30),
"active" tinyint DEFAULT 1 NOT NULL
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -27,8 +27,8 @@
create table llx_chargesociales
(
rowid SERIAL PRIMARY KEY,
"date_ech" datetime, -- date d'echeance
"date_pai" datetime, -- date de paiements
"date_ech" timestamp, -- date d'echeance
"date_pai" timestamp, -- date de paiements
"libelle" varchar(80),
"fk_type" integer,
"amount" real default 0 NOT NULL,

View File

@ -32,9 +32,9 @@ create table llx_commande
"fk_soc_contact" integer,
"fk_projet" integer DEFAULT 0, -- projet auquel est rattache la commande
"ref" varchar(30) NOT NULL, -- propal number
"date_creation" datetime, -- date de creation
"date_valid" datetime, -- date de validation
"date_cloture" datetime, -- date de cloture
"date_creation" timestamp, -- date de creation
"date_valid" timestamp, -- date de validation
"date_cloture" timestamp, -- date de cloture
"date_commande" date, -- date de la commande
"fk_user_author" integer, -- createur de la commande
"fk_user_valid" integer, -- valideur de la commande
@ -49,5 +49,6 @@ create table llx_commande
"total_ttc" real default 0,
"note" text,
"model_pdf" varchar(50),
"facture" tinyint default 0,
4294967294);
"facture" smallint default 0,
"UNIQUE" INDEX (ref)
);

View File

@ -33,9 +33,9 @@ create table llx_commande_fournisseur
"fk_soc_contact" integer,
"fk_projet" integer DEFAULT 0, -- projet auquel est rattache la commande
"ref" varchar(30) NOT NULL, -- propal number
"date_creation" datetime, -- date de creation
"date_valid" datetime, -- date de validation
"date_cloture" datetime, -- date de cloture
"date_creation" timestamp, -- date de creation
"date_valid" timestamp, -- date de validation
"date_cloture" timestamp, -- date de cloture
"date_commande" date, -- date de la commande
"fk_methode_commande" integer default 0,
"fk_user_author" integer, -- createur de la commande
@ -51,4 +51,5 @@ create table llx_commande_fournisseur
"total_ttc" real default 0,
"note" text,
"model_pdf" varchar(50),
4294967294);
"UNIQUE" INDEX (ref)
);

View File

@ -28,7 +28,7 @@ create table llx_commande_fournisseur_log
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"datelog" datetime,
"datelog" timestamp,
"fk_commande" integer NOT NULL,
"fk_statut" smallint NOT NULL,
"fk_user" integer NOT NULL

View File

@ -28,13 +28,13 @@
create table llx_compta
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"datev" date, -- date de valeur
"amount" real DEFAULT 0 NOT NULL ,
"label" varchar(255),
"fk_compta_account" integer,
"fk_user_author" integer,
"fk_user_valid" integer,
"valid" tinyint DEFAULT 0,
"valid" smallint DEFAULT 0,
"note" text
);

View File

@ -28,7 +28,7 @@
create table llx_compta_account
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"number" varchar(12),
"label" varchar(255),
"fk_user_author" integer,

View File

@ -28,9 +28,10 @@
create table llx_compta_compte_generaux
(
rowid SERIAL PRIMARY KEY,
"date_creation" datetime,
"date_creation" timestamp,
"numero" varchar(50),
"intitule" varchar(255),
"fk_user_author" integer,
"note" text
"note" text,
"UNIQUE"(numero)
);

View File

@ -28,9 +28,9 @@ create table llx_concert
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"date_concert" datetime,
"date_concert" timestamp,
"description" text,
"collectif" tinyint DEFAULT 0 NOT NULL,
"collectif" smallint DEFAULT 0 NOT NULL,
"fk_groupart" integer,
"fk_lieu_concert" integer,
"fk_user_author" integer

View File

@ -29,9 +29,9 @@ create table llx_cond_reglement
rowid integer PRIMARY KEY,
"code" varchar(16),
"sortorder" smallint,
"actif" tinyint DEFAULT 1,
"actif" smallint DEFAULT 1,
"libelle" varchar(255),
"libelle_facture" text,
"fdm" tinyint, -- reglement fin de mois
"fdm" smallint, -- reglement fin de mois
"nbjour" smallint
);

View File

@ -35,6 +35,7 @@ create table llx_const
"name" varchar(255),
"value" text, -- max 65535 caracteres
"type" varchar(6) CHECK (type IN ('yesno','texte','chaine')) ,
"visible" tinyint DEFAULT 1 NOT NULL,
"note" text
"visible" smallint DEFAULT 1 NOT NULL,
"note" text,
"UNIQUE" INDEX(name)
);

View File

@ -32,4 +32,5 @@ create table llx_contact_facture
idp SERIAL PRIMARY KEY,
"fk_soc" integer NOT NULL,
"fk_contact" integer NOT NULL, -- point sur llx_socpeople
"UNIQUE" (fk_soc, fk_contact)
);

View File

@ -31,12 +31,12 @@ create table llx_contrat
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"datec" datetime, -- date de creation de l'enregistrement
"date_contrat" datetime,
"datec" timestamp, -- date de creation de l'enregistrement
"date_contrat" timestamp,
"statut" smallint DEFAULT 0,
"mise_en_service" datetime,
"fin_validite" datetime,
"date_cloture" datetime,
"mise_en_service" timestamp,
"fin_validite" timestamp,
"date_cloture" timestamp,
"fk_soc" integer NOT NULL,
"fk_commercial_signature" integer NOT NULL,
"fk_commercial_suivi" integer NOT NULL,

View File

@ -40,11 +40,11 @@ create table llx_contratdet
"statut" smallint DEFAULT 0,
"label" text, -- libellé du produit
"description" text,
"date_commande" datetime,
"date_ouverture_prevue" datetime,
"date_ouverture" datetime, -- date d'ouverture du service chez le client
"date_fin_validite" datetime,
"date_cloture" datetime,
"date_commande" timestamp,
"date_ouverture_prevue" timestamp,
"date_ouverture" timestamp, -- date d'ouverture du service chez le client
"date_fin_validite" timestamp,
"date_cloture" timestamp,
"tva_tx" real DEFAULT 19.6, -- taux tva
"qty" real, -- quantité
"remise_percent" real DEFAULT 0, -- pourcentage de remise

View File

@ -30,7 +30,7 @@ create table llx_contratdet_log
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"fk_contratdet" integer NOT NULL,
"date" datetime,
"date" timestamp,
"statut" smallint NOT NULL,
"fk_user_author" integer NOT NULL,
"commentaire" text

View File

@ -27,9 +27,9 @@ create table llx_cotisation
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"datec" datetime,
"datec" timestamp,
"fk_adherent" integer,
"dateadh" datetime,
"dateadh" timestamp,
"cotisation" real,
"fk_bank" int4 DEFAULT NULL,
"note" text

View File

@ -27,9 +27,9 @@
create table llx_deplacement
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"dated" datetime,
"dated" timestamp,
"fk_user" integer NOT NULL,
"fk_user_author" integer,
"type" smallint NOT NULL,

View File

@ -27,7 +27,7 @@
create table llx_domain
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"label" varchar(255),
"note" text
);

View File

@ -29,8 +29,8 @@ create table llx_don
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"fk_statut" smallint NOT NULL DEFAULT 0,-- etat du don promesse/valid
"datec" datetime, -- date de création de l'enregistrement
"datedon" datetime, -- date du don/promesse
"datec" timestamp, -- date de création de l'enregistrement
"datedon" timestamp, -- date du don/promesse
"amount" real DEFAULT 0,
"fk_paiement" integer,
"prenom" varchar(50),

View File

@ -28,7 +28,7 @@ create table llx_don_projet
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"datec" datetime,
"datec" timestamp,
"libelle" varchar(255),
"fk_user_author" integer NOT NULL,
"note" text

View File

@ -28,11 +28,11 @@
create table llx_entrepot
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"label" varchar(255) NOT NULL,
"description" text,
"statut" tinyint DEFAULT 1, -- 1 ouvert, 0 fermé
"statut" smallint DEFAULT 1, -- 1 ouvert, 0 fermé
"fk_user_author" integer
);

View File

@ -31,8 +31,8 @@ create table llx_expedition
"tms" timestamp,
"ref" varchar(30) NOT NULL,
"fk_commande" integer,
"date_creation" datetime, -- date de creation
"date_valid" datetime, -- date de validation
"date_creation" timestamp, -- date de creation
"date_valid" timestamp, -- date de validation
"date_expedition" date, -- date de l'expedition
"fk_user_author" integer, -- createur
"fk_user_valid" integer, -- valideur
@ -41,7 +41,8 @@ create table llx_expedition
"fk_statut" smallint DEFAULT 0,
"note" text,
"model_pdf" varchar(50),
4294967294);
"UNIQUE" INDEX (ref)
);
CREATE INDEX llx_expedition_fk_expedition_methode ON llx_expedition (fk_expedition_methode);
CREATE INDEX llx_expedition_fk_commande ON llx_expedition (fk_commande);

View File

@ -31,5 +31,5 @@ create table llx_expedition_methode
"code" varchar(30) NOT NULL,
"libelle" varchar(50) NOT NULL,
"description" text,
"statut" tinyint DEFAULT 0
"statut" smallint DEFAULT 0
);

View File

@ -30,7 +30,7 @@ create table llx_export_compta
(
rowid SERIAL PRIMARY KEY,
"ref" varchar(12) NOT NULL,
"date_export" datetime, -- date de creation
"date_export" timestamp, -- date de creation
"fk_user" integer NOT NULL,
"note" text
);

View File

@ -30,7 +30,7 @@ create table llx_facture
"facnumber" varchar(50) NOT NULL,
"increment" varchar(10),
"fk_soc" integer NOT NULL,
"datec" datetime, -- date de creation de la facture
"datec" timestamp, -- date de creation de la facture
"datef" date, -- date de la facture
"paye" smallint DEFAULT 0 NOT NULL,
"amount" real DEFAULT 0 NOT NULL,
@ -49,5 +49,6 @@ create table llx_facture
"fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement)
"date_lim_reglement" date, -- date limite de reglement
"note" text,
4294967294 "INDEX" fksoc (fk_soc)
"UNIQUE" INDEX (facnumber),
"INDEX" fksoc (fk_soc)
);

View File

@ -33,7 +33,7 @@ create table llx_facture_fourn
rowid SERIAL PRIMARY KEY,
"facnumber" varchar(50) NOT NULL,
"fk_soc" integer NOT NULL,
"datec" datetime, -- date de creation de la facture
"datec" timestamp, -- date de creation de la facture
"datef" date, -- date de la facture
"libelle" varchar(255),
"paye" smallint DEFAULT 0 NOT NULL,
@ -47,5 +47,6 @@ create table llx_facture_fourn
"fk_statut" smallint DEFAULT 0 NOT NULL,
"fk_user_author" integer, -- createur de la facture
"fk_user_valid" integer, -- valideur de la facture
"note" text
"note" text,
"UNIQUE" INDEX (facnumber, fk_soc)
);

View File

@ -32,7 +32,7 @@ create table llx_facture_rec
rowid SERIAL PRIMARY KEY,
"titre" varchar(50) NOT NULL,
"fk_soc" integer NOT NULL,
"datec" datetime, -- date de creation
"datec" timestamp, -- date de creation
"amount" real DEFAULT 0 NOT NULL,
"remise" real DEFAULT 0,
"remise_percent" real DEFAULT 0,

View File

@ -37,8 +37,8 @@ create table llx_facturedet
"remise" real DEFAULT 0, -- montant de la remise
"subprice" real, -- prix avant remise
"price" real, -- prix final
"date_start" datetime, -- date debut si service
"date_end" datetime, -- date fin si service
"date_start" timestamp, -- date debut si service
"date_end" timestamp, -- date fin si service
"fk_code_ventilation" integer DEFAULT 0 NOT NULL,
"fk_export_compta" integer DEFAULT 0 NOT NULL
);

View File

@ -31,12 +31,13 @@ create table llx_fichinter
"fk_soc" integer NOT NULL,
"fk_projet" integer DEFAULT 0, -- projet auquel est rattache la fiche
"ref" varchar(30) NOT NULL, -- number
"datec" datetime, -- date de creation
"date_valid" datetime, -- date de validation
"datec" timestamp, -- date de creation
"date_valid" timestamp, -- date de validation
"datei" date, -- date de l'intervention
"fk_user_author" integer, -- createur de la fiche
"fk_user_valid" integer, -- valideur de la fiche
"fk_statut" smallint DEFAULT 0,
"duree" real,
"note" text,
4294967294);
"UNIQUE" INDEX (ref)
);

View File

@ -28,8 +28,9 @@
create table llx_groupesociete
(
rowid SERIAL PRIMARY KEY,
"parent" integer UNIQUE,
"tms" timestamp,
"datec" datetime, -- creation date
"datec" timestamp, -- creation date
"nom" varchar(60), -- company name
"note" text, --
"remise" real DEFAULT 0, -- remise systématique pour le client

View File

@ -32,7 +32,7 @@ create table llx_groupesociete_remise
rowid SERIAL PRIMARY KEY,
"fk_groupe" integer NOT NULL,
"tms" timestamp,
"datec" datetime, -- creation date
"datec" timestamp, -- creation date
"fk_user_author" integer, -- utilisateur qui a créé l'info
"remise" real DEFAULT 0, -- remise systématique pour le client
"note" text

View File

@ -30,8 +30,8 @@ create table llx_livre
rowid SERIAL PRIMARY KEY,
"oscid" integer NOT NULL,
"tms" timestamp,
"status" tinyint,
"date_ajout" datetime,
"status" smallint,
"date_ajout" timestamp,
"ref" varchar(12),
"title" varchar(64),
"annee" int2,
@ -39,6 +39,7 @@ create table llx_livre
"prix" decimal(15,4),
"fk_editeur" integer,
"fk_user_author" integer,
"frais_de_port" tinyint DEFAULT 1
"frais_de_port" smallint DEFAULT 1,
"UNIQUE"(ref)
);

View File

@ -28,5 +28,6 @@
create table llx_livre_to_auteur
(
"fk_livre" integer NOT NULL,
"fk_auteur" integer NOT NULL
"fk_auteur" integer NOT NULL,
"unique" index (fk_livre, fk_auteur)
);

View File

@ -40,7 +40,7 @@ create table llx_mailing
(
rowid SERIAL PRIMARY KEY,
"statut" smallint DEFAULT 0, --
"date_envoi" datetime, -- date d'envoi
"date_envoi" timestamp, -- date d'envoi
"titre" varchar(60), -- company name
"sujet" varchar(60), -- company name
"body" text,
@ -49,9 +49,9 @@ create table llx_mailing
"email_from" varchar(160), -- company name
"email_replyto" varchar(160), -- company name
"email_errorsto" varchar(160), -- company name
"date_creat" datetime, -- creation date
"date_valid" datetime, -- creation date
"date_appro" datetime, -- creation date
"date_creat" timestamp, -- creation date
"date_valid" timestamp, -- creation date
"date_appro" timestamp, -- creation date
"fk_user_creat" integer, -- utilisateur qui a créé l'info
"fk_user_valid" integer, -- utilisateur qui a créé l'info
"fk_user_appro" integer -- utilisateur qui a créé l'info

View File

@ -27,7 +27,7 @@
create table llx_newsletter
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"email_subject" varchar(32) NOT NULL,
"email_from_name" varchar(255) NOT NULL,
@ -37,9 +37,9 @@ create table llx_newsletter
"target" smallint,
"sql_target" text,
"status" smallint DEFAULT 0 NOT NULL,
"date_send_request" datetime, -- debut de l'envoi demandé
"date_send_begin" datetime, -- debut de l'envoi
"date_send_end" datetime, -- fin de l'envoi
"date_send_request" timestamp, -- debut de l'envoi demandé
"date_send_begin" timestamp, -- debut de l'envoi
"date_send_end" timestamp, -- fin de l'envoi
"nbsent" integer, -- nombre de mails envoyés
"nberror" integer, -- nombre de mails envoyés
"fk_user_author" integer,

View File

@ -28,7 +28,7 @@ create table llx_notify
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"daten" datetime, -- date de la notification
"daten" timestamp, -- date de la notification
"fk_action" integer NOT NULL,
"fk_contact" integer NOT NULL,
"objet_type" varchar(10) CHECK (objet_type IN ('ficheinter','facture','propale')) ,

View File

@ -33,9 +33,9 @@ create table llx_paiement
(
rowid SERIAL PRIMARY KEY,
"fk_facture" integer,
"datec" datetime, -- date de creation
"datec" timestamp, -- date de creation
"tms" timestamp,
"datep" datetime, -- payment date
"datep" timestamp, -- payment date
"amount" real DEFAULT 0,
"author" varchar(50),
"fk_paiement" integer NOT NULL,

View File

@ -28,9 +28,9 @@ create table llx_paiementcharge
(
rowid SERIAL PRIMARY KEY,
"fk_charge" integer,
"datec" datetime, -- date de creation
"datec" timestamp, -- date de creation
"tms" timestamp,
"datep" datetime, -- payment date
"datep" timestamp, -- payment date
"amount" real DEFAULT 0,
"fk_typepaiement" integer NOT NULL,
"num_paiement" varchar(50),

View File

@ -28,9 +28,9 @@ create table llx_paiementfourn
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"datec" datetime, -- date de creation de l'enregistrement
"datec" timestamp, -- date de creation de l'enregistrement
"fk_facture_fourn" integer, -- facture
"datep" datetime, -- date de paiement
"datep" timestamp, -- date de paiement
"amount" real DEFAULT 0, -- montant
"fk_user_author" integer, -- auteur
"fk_paiement" integer NOT NULL, -- moyen de paiement

View File

@ -25,7 +25,7 @@
create table llx_pointmort
(
"month" datetime,
"month" timestamp,
"amount" real
);

View File

@ -29,14 +29,15 @@ create table llx_prelevement
(
rowid SERIAL PRIMARY KEY,
"ref" varchar(12), -- reference
"datec" datetime, -- date de creation
"datec" timestamp, -- date de creation
"amount" real DEFAULT 0, -- montant total du prelevement
"credite" smallint DEFAULT 0, -- indique si le prelevement a été credité
"note" text,
"date_trans" datetime,
"date_trans" timestamp,
"method_trans" smallint,
"fk_user_trans" integer,
"date_credit" datetime,
"date_credit" timestamp,
"fk_user_credit" integer,
"UNIQUE"(ref)
);

View File

@ -32,15 +32,16 @@ create table llx_prelevement_bons
(
rowid SERIAL PRIMARY KEY,
"ref" varchar(12), -- reference
"datec" datetime, -- date de creation
"datec" timestamp, -- date de creation
"amount" real DEFAULT 0, -- montant total du prélèvement
"statut" smallint DEFAULT 0, -- statut
"credite" smallint DEFAULT 0, -- indique si le prelevement a été credité
"note" text,
"date_trans" datetime, -- date de transmission à la banque
"date_trans" timestamp, -- date de transmission à la banque
"method_trans" smallint, -- méthode de transmission
"fk_user_trans" integer, -- user qui a effectué la transmission
"date_credit" datetime, -- date de crédit sur le compte
"date_credit" timestamp, -- date de crédit sur le compte
"fk_user_credit" integer, -- user qui a remonté l'info de crédit
"UNIQUE"(ref)
);

View File

@ -25,10 +25,10 @@
--
--
create table llx_prelevement_facture
(
rowid SERIAL PRIMARY KEY,
"fk_facture" integer NOT NULL,
"fk_prelevement" integer NOT NULL,
"statut" smallint DEFAULT 0
"fk_facture" integer NOT NULL,
"fk_prelevement_lignes" integer NOT NULL
);

View File

@ -30,15 +30,15 @@
create table llx_prelevement_facture_demande
(
rowid SERIAL PRIMARY KEY,
"fk_facture" integer NOT NULL,
"amount" real NOT NULL,
"date_demande" datetime,
"traite" smallint DEFAULT 0,
"date_traite" datetime,
"fk_prelevement" integer,
"fk_user_demande" integer NOT NULL,
"code_banque" varchar(7),
"code_guichet" varchar(6),
"number" varchar(255),
"cle_rib" varchar(5)
"fk_facture" integer NOT NULL,
"amount" real NOT NULL,
"date_demande" timestamp,
"traite" smallint DEFAULT 0,
"date_traite" timestamp,
"fk_prelevement_bons" integer,
"fk_user_demande" integer NOT NULL,
"code_banque" varchar(7),
"code_guichet" varchar(6),
"number" varchar(255),
"cle_rib" varchar(5)
);

View File

@ -29,11 +29,9 @@
create table llx_prelevement_rejet
(
rowid SERIAL PRIMARY KEY,
"fk_soc" integer NOT NULL,
"fk_prelevement" integer,
"amount" real DEFAULT 0, -- montant total du prelevement
"motif" integer,
"note" text,
"date_creation" datetime,
"fk_user_creation" integer
"fk_prelevement_lignes" integer,
"motif" integer,
"date_creation" timestamp,
"fk_user_creation" integer,
"note" text
);

View File

@ -28,14 +28,15 @@
create table llx_product
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"ref" varchar(15) UNIQUE,
"label" varchar(255),
"description" text,
"price" double,
"tva_tx" double DEFAULT 19.6,
"fk_user_author" integer,
"envente" tinyint DEFAULT 1,
"envente" smallint DEFAULT 1,
"nbvente" integer DEFAULT 0,
"fk_product_type" integer DEFAULT 0,
"duration" varchar(6),

View File

@ -28,7 +28,7 @@
create table llx_product_fournisseur
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"fk_product" integer,
"fk_soc" integer,

View File

@ -28,7 +28,7 @@
create table llx_product_fournisseur_price
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"fk_product" integer,
"fk_soc" integer, -- lien sur llx_societe

View File

@ -29,10 +29,10 @@ create table llx_product_price
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"fk_product" integer NOT NULL,
"date_price" datetime,
"date_price" timestamp,
"price" double,
"tva_tx" double DEFAULT 19.6,
"fk_user_author" integer,
"envente" tinyint DEFAULT 1
"envente" smallint DEFAULT 1
);

View File

@ -37,5 +37,6 @@ create table llx_projet
"title" varchar(255),
"fk_user_resp" integer, -- responsable du projet
"fk_user_creat" integer, -- createur du projet
"note" text
"note" text,
"UNIQUE" INDEX(ref)
);

View File

@ -31,10 +31,10 @@ create table llx_propal
"fk_soc_contact" integer,
"fk_projet" integer DEFAULT 0, -- projet auquel est rattache la propale
"ref" varchar(30) NOT NULL, -- propal number
"datec" datetime, -- date de creation
"fin_validite" datetime, -- date de fin de validite
"date_valid" datetime, -- date de validation
"date_cloture" datetime, -- date de cloture
"datec" timestamp, -- date de creation
"fin_validite" timestamp, -- date de fin de validite
"date_valid" timestamp, -- date de validation
"date_cloture" timestamp, -- date de cloture
"datep" date, -- date de la propal
"fk_user_author" integer, -- createur de la propale
"fk_user_valid" integer, -- valideur de la propale
@ -47,4 +47,5 @@ create table llx_propal
"total" real DEFAULT 0,
"note" text,
"model_pdf" varchar(50),
4294967294);
"UNIQUE" INDEX (ref)
);

View File

@ -32,6 +32,6 @@ create table llx_rights_def
"perms" varchar(50),
"subperms" varchar(50),
"type" varchar(1) CHECK (type IN ('r','w','m','d','a')) ,
"bydefault" tinyint DEFAULT 0
"bydefault" smallint DEFAULT 0
);

View File

@ -31,5 +31,6 @@ create table llx_so_gr
(
rowid SERIAL PRIMARY KEY,
"fk_soc" integer,
"fk_groupe" integer
"fk_groupe" integer,
"UNIQUE"(fk_soc, fk_groupe)
);

View File

@ -28,8 +28,8 @@ create table llx_soc_events
(
rowid SERIAL PRIMARY KEY, -- public id
"fk_soc" int NOT NULL, --
"dateb" datetime NOT NULL, -- begin date
"datee" datetime NOT NULL, -- end date
"dateb" timestamp NOT NULL, -- begin date
"datee" timestamp NOT NULL, -- end date
"title" varchar(100) NOT NULL,
"url" varchar(255),
"description" text

View File

@ -30,6 +30,6 @@ create table llx_soc_recontact
(
rowid SERIAL PRIMARY KEY,
"fk_soc" integer,
"datere" datetime,
"datere" timestamp,
"author" varchar(15)
);

View File

@ -32,8 +32,8 @@ create table llx_societe
"active" smallint DEFAULT 0, --
"parent" integer DEFAULT 0, --
"tms" timestamp,
"datec" datetime, -- creation date
"datea" datetime, -- activation date
"datec" timestamp, -- creation date
"datea" timestamp, -- activation date
"nom" varchar(60), -- company name
"code_client" varchar(15), -- code client
"code_compta" varchar(15), -- code compta
@ -65,5 +65,6 @@ create table llx_societe
"fk_user_creat" integer, -- utilisateur qui a créé l'info
"fk_user_modif" integer, -- utilisateur qui a modifié l'info
"remise_client" real DEFAULT 0, -- remise systématique pour le client
"UNIQUE" INDEX(prefix_comm)
);

View File

@ -29,6 +29,7 @@ create table llx_societe_commerciaux
(
rowid SERIAL PRIMARY KEY,
"fk_soc" integer,
"fk_user" integer
"fk_user" integer,
"UNIQUE" INDEX(fk_soc, fk_user)
);

View File

@ -32,7 +32,7 @@ create table llx_societe_remise
rowid SERIAL PRIMARY KEY,
"fk_soc" integer NOT NULL,
"tms" timestamp,
"datec" datetime, -- creation date
"datec" timestamp, -- creation date
"fk_user_author" integer, -- utilisateur qui a créé l'info
"remise_client" real DEFAULT 0, -- remise systématique pour le client
"note" text

View File

@ -32,7 +32,7 @@ create table llx_societe_remise_except
(
rowid SERIAL PRIMARY KEY,
"fk_soc" integer NOT NULL, -- client
"datec" datetime,
"datec" timestamp,
"amount_ht" real NOT NULL,
"fk_user" integer NOT NULL,
"fk_facture" integer,

View File

@ -32,7 +32,7 @@ create table llx_societe_rib
(
rowid SERIAL PRIMARY KEY,
"fk_soc" integer NOT NULL,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"label" varchar(30),
"bank" varchar(255),

View File

@ -27,7 +27,7 @@
create table llx_socpeople
(
idp SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"fk_soc" integer, -- lien vers la societe
"civilite" varchar(6),

View File

@ -27,7 +27,7 @@
create table llx_socstatutlog
(
id SERIAL PRIMARY KEY,
"datel" datetime,
"datel" timestamp,
"fk_soc" integer,
"fk_statut" integer,
"author" varchar(30)

View File

@ -29,7 +29,7 @@ create table llx_stock_mouvement
(
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"datem" datetime,
"datem" timestamp,
"fk_product" integer NOT NULL,
"fk_entrepot" integer NOT NULL,
"value" integer,

View File

@ -30,7 +30,7 @@
create table llx_todocomm
(
id SERIAL PRIMARY KEY,
"datea" datetime, -- date de l'action
"datea" timestamp, -- date de l'action
"label" varchar(50), -- libelle de l'action
"fk_user_action" integer, -- id de la personne qui doit effectuer l'action
"fk_user_author" integer, -- id auteur de l'action

View File

@ -28,7 +28,7 @@
create table llx_user
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"login" varchar(8),
"pass" varchar(32),
@ -42,5 +42,6 @@ create table llx_user
"module_compta" smallint DEFAULT 1,
"fk_societe" integer DEFAULT 0,
"fk_socpeople" integer DEFAULT 0,
"note" text
"note" text,
"UNIQUE" INDEX(login)
);

View File

@ -31,5 +31,6 @@ create table llx_user_param
"fk_user" integer,
"page" varchar(255),
"param" varchar(64),
"value" varchar(255)
"value" varchar(255),
"UNIQUE" (fk_user,page,param)
);

View File

@ -29,6 +29,7 @@ create table llx_user_rights
(
rowid SERIAL PRIMARY KEY,
"fk_user" integer NOT NULL,
"fk_id" integer NOT NULL
"fk_id" integer NOT NULL,
"UNIQUE"(fk_user,fk_id)
);

View File

@ -29,7 +29,8 @@
create table llx_usergroup
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"tms" timestamp,
"nom" varchar(255) NOT NULL UNIQUE,
"note" text
);

View File

@ -29,6 +29,7 @@ create table llx_usergroup_rights
(
rowid SERIAL PRIMARY KEY,
"fk_usergroup" integer NOT NULL,
"fk_id" integer NOT NULL
"fk_id" integer NOT NULL,
"UNIQUE"(fk_usergroup,fk_id)
);

View File

@ -29,5 +29,6 @@ create table llx_usergroup_user
(
rowid SERIAL PRIMARY KEY,
"fk_user" integer NOT NULL,
"fk_usergroup" integer NOT NULL
"fk_usergroup" integer NOT NULL,
"UNIQUE"(fk_user,fk_usergroup)
);

View File

@ -29,8 +29,8 @@ create table llx_ventes
rowid SERIAL PRIMARY KEY,
"fk_soc" integer NOT NULL,
"fk_product" integer NOT NULL,
"dated" datetime, -- date debut
"datef" datetime, -- date fin
"dated" timestamp, -- date debut
"datef" timestamp, -- date fin
"price" real,
"author" varchar(30),
"active" smallint DEFAULT 0 NOT NULL,

View File

@ -33,10 +33,10 @@
create table llx_voyage
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"dateo" date, -- date operation
"date_depart" datetime, -- date du voyage
"date_arrivee" datetime, -- date du voyage
"date_depart" timestamp, -- date du voyage
"date_arrivee" timestamp, -- date du voyage
"amount" real NOT NULL DEFAULT 0, -- prix du billet
"reduction" real NOT NULL DEFAULT 0, -- montant de la reduction obtenue
"depart" varchar(255),

View File

@ -27,7 +27,7 @@
create table llx_voyage_reduc
(
rowid SERIAL PRIMARY KEY,
"datec" datetime,
"datec" timestamp,
"datev" date, -- date de valeur
"date_debut" date, -- date operation
"date_fin" date,