diff --git a/htdocs/install/etape0.php b/htdocs/install/etape0.php index ee9f1a2f2f0..ebadf70c211 100644 --- a/htdocs/install/etape0.php +++ b/htdocs/install/etape0.php @@ -78,9 +78,13 @@ if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on") if ($_POST["db_type"] == 'mysql' ||$_POST["db_type"] == 'mysqli') { $databasefortest='mysql'; - }else{ + }elseif ($_POST["db_type"] == 'pgsql') + { $databasefortest='postgres'; } + else{ + $databasefortest='mssql'; + } $db = new DoliDb($_POST["db_type"],$_POST["db_host"],$userroot,$passroot,$databasefortest); }else{ $db = new DoliDb($_POST["db_type"],$_POST["db_host"],$_POST["db_user"],$_POST["db_pass"],$_POST["db_name"]); diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index d51a290a790..978e27d780f 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -56,6 +56,7 @@ $langs->load("install"); if ($dolibarr_main_db_type == "mysql") $choix=1; if ($dolibarr_main_db_type == "mysqli") $choix=1; if ($dolibarr_main_db_type == "pgsql") $choix=2; +if ($dolibarr_main_db_type == "mssql") $choix=3; dolibarr_install_syslog("upgrade: Entering upgrade.php page"); @@ -191,7 +192,8 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade") if ($ok) { if ($choix==1) $dir = "../../mysql/migration/"; - else $dir = "../../pgsql/migration/"; + elseif ($choix==2) $dir = "../../pgsql/migration/"; + else $dir = "../../mssql/migration/"; $filelist=array(); $i = 0; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index a0b849d6580..46482c231a7 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -61,6 +61,7 @@ $langs->load("suppliers"); if ($dolibarr_main_db_type == 'mysql') $choix=1; if ($dolibarr_main_db_type == 'mysqli') $choix=1; if ($dolibarr_main_db_type == 'pgsql') $choix=2; +if ($dolibarr_main_db_type == 'mssql') $choix=3; dolibarr_install_syslog("upgrade2: Entering upgrade2.php page"); diff --git a/mssql/Makefile b/mssql/Makefile new file mode 100644 index 00000000000..1d87115be0e --- /dev/null +++ b/mssql/Makefile @@ -0,0 +1,100 @@ +# Copyright (C) 2001-2003 Rodolphe Quiedeville +# Copyright (C) 2005 Laurent Destailleur +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# $Id$ +# $Source$ +# +# ********************************************************************** +# Ce makefile permet d'initialiser la base de donnée de dolibarr en manuel. +# Il n'est utile que si vous n'utilisez pas l'installateur automatique +# accessible à http://localhost/dolibarr/install/ +# +# Pour une installation manuelle, créer la base dolibarr puis faire: +# make mssql.sql +# mysql dolibarr < mssql.sql +# +# Le script mssql.sql cotient tous le ordres sql pour créer la base +# Tables + Index et Clés + Données +# +# ********************************************************************** + +# Penser à rajouter le commutateur -S pour un serveur autre que localhost +# Vous pouvez remplacer -E par -U et -P si vous voulez utiliser l'authentification SQL + +# Vous aurez besoin des outils GNU précompilé pour Windows (provenant de Cygwin par exemple) pour générer et +# exécuter ce script +SQL=sqlcmd -E -Q +BASE=dolibarr +OPTIONS= + +FIND=find +#FIND="c:/Program files/cygwin/bin/find" + + +TABLES=$(shell $(FIND) tables/ -name "*sql") + + +all: + cat README + +load: + $(SQL) $(OPTIONS) $(BASE) < data/data.sql + +dev: + cd data \ + && make dev BASE=$(BASE) OPTIONS=$(OPTIONS) + + + +dropall: dropdb droppriv + +droppriv: + $(SQL) $(OPTIONS) $(SQL) -e "delete from db where Db='$(BASE)' ; " + +dropdb: + $(SQL) $(OPTIONS) $(SQL) -f -e "drop database if exists $(BASE) ; " + + + +create: createdb createpriv + +createdb: + $(SQL) $(OPTIONS) "create database $(BASE) ; " + +createpriv: + $(SQL) $(OPTIONS) "insert into db (Host, Db) values ('localhost', '$(BASE)') ; " + $(SQL) $(OPTIONS) "update db set select_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set insert_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set update_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set delete_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set create_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set drop_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set grant_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set references_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set index_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "update db set alter_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) "flush privileges ; " + + + +mssql.sql: $(TABLES) data/data.sql Makefile + echo "-- Fichier généré par make mssql.sql" > mssql.sql + echo "-- Contient les ordres de creation des tables + les clés + les données" >> mssql.sql + echo "-- ;" >> mssql.sql + $(FIND) tables/ -name "*sql" | grep -v "key.sql" | xargs cat | grep -v "^--" | cut -d "-" -f 1 >> mssql.sql + $(FIND) tables/ -name "*sql" | grep "key.sql" | xargs cat | grep -v "^--" | cut -d "-" -f 1 >> mssql.sql + cat data/data.sql | grep -v ^-- >> mssql.sql diff --git a/mssql/README b/mssql/README new file mode 100644 index 00000000000..0520c3b5d02 --- /dev/null +++ b/mssql/README @@ -0,0 +1,8 @@ +# Makefile Options +##################### + +- mssql.sql Génère un fichier sql unique pour l'installation (Contient les + ordres de création des tables + clés et index + données) + +- load Charge les données minimales définies dans data/data.sql + diff --git a/mssql/functions/functions.sql b/mssql/functions/functions.sql index 8afd953f8f8..c816fe42941 100644 Binary files a/mssql/functions/functions.sql and b/mssql/functions/functions.sql differ diff --git a/mssql/tables/llx_accountingaccount.sql b/mssql/tables/llx_accountingaccount.sql index 39afa95b230..d21aa0e4229 100644 --- a/mssql/tables/llx_accountingaccount.sql +++ b/mssql/tables/llx_accountingaccount.sql @@ -21,7 +21,7 @@ create table llx_accountingaccount ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, fk_pcg_version varchar(12) NOT NULL, pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, diff --git a/mssql/tables/llx_accountingdebcred.sql b/mssql/tables/llx_accountingdebcred.sql index 30cdc271908..b90bb0db7e8 100644 --- a/mssql/tables/llx_accountingdebcred.sql +++ b/mssql/tables/llx_accountingdebcred.sql @@ -21,8 +21,8 @@ create table llx_accountingdebcred ( - fk_transaction int NOT NULL, - fk_account int NOT NULL, + fk_transaction integer NOT NULL, + fk_account integer NOT NULL, amount real NOT NULL, direction varchar(1) NOT NULL ); diff --git a/mssql/tables/llx_accountingsystem.sql b/mssql/tables/llx_accountingsystem.sql index ed6f61a451d..3e3e4fa48de 100644 --- a/mssql/tables/llx_accountingsystem.sql +++ b/mssql/tables/llx_accountingsystem.sql @@ -22,7 +22,7 @@ create table llx_accountingsystem ( pcg_version varchar(12) PRIMARY KEY, - fk_pays int NOT NULL, + fk_pays integer NOT NULL, label varchar(128) NOT NULL, datec varchar(12) NOT NULL, fk_author varchar(20), diff --git a/mssql/tables/llx_accountingtransaction.sql b/mssql/tables/llx_accountingtransaction.sql index 7504316f7d8..3256ee8c209 100644 --- a/mssql/tables/llx_accountingtransaction.sql +++ b/mssql/tables/llx_accountingtransaction.sql @@ -21,13 +21,13 @@ create table llx_accountingtransaction ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, label varchar(128) NOT NULL, datec datetime NOT NULL, fk_author varchar(20) NOT NULL, tms timestamp, - fk_facture int, - fk_facture_fourn int, - fk_paiement int, - fk_paiement_fourn int + fk_facture integer, + fk_facture_fourn integer, + fk_paiement integer, + fk_paiement_fourn integer ); diff --git a/mssql/tables/llx_action_def.sql b/mssql/tables/llx_action_def.sql index efb8827a8a7..d1ba3094d1e 100644 --- a/mssql/tables/llx_action_def.sql +++ b/mssql/tables/llx_action_def.sql @@ -24,7 +24,7 @@ create table llx_action_def ( - rowid int NOT NULL PRIMARY KEY, + rowid integer NOT NULL PRIMARY KEY, code varchar(25) UNIQUE NOT NULL, tms timestamp, titre varchar(255) NOT NULL, diff --git a/mssql/tables/llx_actioncomm.sql b/mssql/tables/llx_actioncomm.sql index 44ecec5fdd3..ebabda29a68 100644 --- a/mssql/tables/llx_actioncomm.sql +++ b/mssql/tables/llx_actioncomm.sql @@ -25,23 +25,23 @@ create table llx_actioncomm ( - id int IDENTITY PRIMARY KEY, - datec datetime, -- date creation - datep datetime, -- date debut planifiee - datep2 datetime, -- date fin planifiee si action non ponctuelle - datea datetime, -- date debut realisation - datea2 datetime, -- date fin realisation si action non ponctuelle - tms timestamp, -- date modif - fk_action int, -- type de l'action + id integer IDENTITY PRIMARY KEY, + datec datetime, -- SMALLDATETIME creation + datep datetime, -- SMALLDATETIME debut planifiee + datep2 datetime, -- SMALLDATETIME fin planifiee si action non ponctuelle + datea datetime, -- SMALLDATETIME debut realisation + datea2 datetime, -- SMALLDATETIME fin realisation si action non ponctuelle + tms timestamp, -- SMALLDATETIME modif + fk_action integer, -- type de l'action label varchar(50) NOT NULL, -- libelle de l'action - fk_project int, - fk_soc int, - fk_contact int, - fk_parent int NOT NULL default 0, + fk_project integer, + fk_soc integer, + fk_contact integer, + fk_parent integer NOT NULL default 0, - fk_user_action int, -- id de la personne qui doit effectuer l'action - fk_user_author int, -- id de la personne qui a effectuer l'action + fk_user_action integer, -- id de la personne qui doit effectuer l'action + fk_user_author integer, -- id de la personne qui a effectuer l'action priority smallint, punctual smallint NOT NULL default 1, [percent] smallint NOT NULL default 0, @@ -49,9 +49,9 @@ create table llx_actioncomm durationa real, -- duree reellement passee note text, - propalrowid int, - fk_commande int, - fk_facture int + propalrowid integer, + fk_commande integer, + fk_facture integer ); diff --git a/mssql/tables/llx_adherent.sql b/mssql/tables/llx_adherent.sql index 9a6894eced9..fe7f93f9720 100644 --- a/mssql/tables/llx_adherent.sql +++ b/mssql/tables/llx_adherent.sql @@ -29,7 +29,7 @@ create table llx_adherent ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, nom varchar(50), prenom varchar(50), login varchar(50) NOT NULL, -- login @@ -45,18 +45,18 @@ create table llx_adherent phone varchar(30), phone_perso varchar(30), phone_mobile varchar(30), - naiss datetime, -- date de naissance + naiss datetime, -- SMALLDATETIME de naissance photo varchar(255), -- url vers photo statut smallint NOT NULL DEFAULT 0, [public] smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils [public] ou pas ? - datefin datetime, -- date de fin de validité de la cotisation + datefin datetime, -- SMALLDATETIME de fin de validité de la cotisation note text, - datevalid datetime, -- date de validation - datec datetime, -- date de creation - tms timestamp, -- date de modification - fk_user_author int NOT NULL, - fk_user_mod int NOT NULL, - fk_user_valid int NOT NULL, + datevalid datetime, -- SMALLDATETIME de validation + datec datetime, -- SMALLDATETIME de creation + tms timestamp, -- SMALLDATETIME de modification + fk_user_author integer NOT NULL, + fk_user_mod integer NOT NULL, + fk_user_valid integer NOT NULL, ); CREATE UNIQUE INDEX login ON llx_adherent(login) diff --git a/mssql/tables/llx_adherent_options.sql b/mssql/tables/llx_adherent_options.sql index 27f309d4f41..3b9ff2f0f2d 100644 --- a/mssql/tables/llx_adherent_options.sql +++ b/mssql/tables/llx_adherent_options.sql @@ -23,9 +23,9 @@ create table llx_adherent_options ( - optid int IDENTITY PRIMARY KEY, + optid integer IDENTITY PRIMARY KEY, tms timestamp, - adhid int NOT NULL, -- id de l'adherent auquel correspond ces attributs optionnel + adhid integer NOT NULL, -- id de l'adherent auquel correspond ces attributs optionnel ); CREATE UNIQUE INDEX adhid ON llx_adherent_options(adhid) diff --git a/mssql/tables/llx_adherent_type.sql b/mssql/tables/llx_adherent_type.sql index 43c24da70c7..bb67e53f571 100644 --- a/mssql/tables/llx_adherent_type.sql +++ b/mssql/tables/llx_adherent_type.sql @@ -27,7 +27,7 @@ create table llx_adherent_type ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, statut smallint NOT NULL DEFAULT 0, libelle varchar(50), diff --git a/mssql/tables/llx_appro.sql b/mssql/tables/llx_appro.sql index a05e73b03f7..6be89b45641 100644 --- a/mssql/tables/llx_appro.sql +++ b/mssql/tables/llx_appro.sql @@ -22,12 +22,12 @@ create table llx_appro ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, - fk_product int NOT NULL, + fk_product integer NOT NULL, quantity smallint NOT NULL, price real, - fk_user_author int + fk_user_author integer ); diff --git a/mssql/tables/llx_bank.sql b/mssql/tables/llx_bank.sql index 2f59d492799..43950f2e857 100644 --- a/mssql/tables/llx_bank.sql +++ b/mssql/tables/llx_bank.sql @@ -23,21 +23,21 @@ create table llx_bank ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, - datev datetime, -- date de valeur - dateo datetime, -- date operation + datev datetime, -- SMALLDATETIME de valeur + dateo datetime, -- SMALLDATETIME operation amount real NOT NULL default 0, label varchar(255), - fk_account int, - fk_user_author int, - fk_user_rappro int, + fk_account integer, + fk_user_author integer, + fk_user_rappro integer, fk_type varchar(4), -- CB, Virement, cheque num_releve varchar(50), - num_chq int, + num_chq integer, rappro tinyint default 0, note text, - fk_bordereau int DEFAULT 0, + fk_bordereau integer DEFAULT 0, banque varchar(255), -- banque pour les cheques emetteur varchar(255), -- emetteur du cheque author varchar(40) -- a supprimer apres migration diff --git a/mssql/tables/llx_bank_account.sql b/mssql/tables/llx_bank_account.sql index d53e9a00fdc..c134d0d3022 100644 --- a/mssql/tables/llx_bank_account.sql +++ b/mssql/tables/llx_bank_account.sql @@ -27,7 +27,7 @@ create table llx_bank_account ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, ref varchar(12) NOT NULL, @@ -48,7 +48,7 @@ create table llx_bank_account url varchar(128), account_number varchar(8), currency_code varchar(2) NOT NULL, - min_allowed int DEFAULT 0, - min_desired int DEFAULT 0, + min_allowed integer DEFAULT 0, + min_desired integer DEFAULT 0, comment varchar(254) ); diff --git a/mssql/tables/llx_bank_categ.sql b/mssql/tables/llx_bank_categ.sql index 152da57bee8..3c0fafba6b7 100644 --- a/mssql/tables/llx_bank_categ.sql +++ b/mssql/tables/llx_bank_categ.sql @@ -20,6 +20,6 @@ create table llx_bank_categ ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, label varchar(255) ); diff --git a/mssql/tables/llx_bank_class.sql b/mssql/tables/llx_bank_class.sql index f3abecfd2da..abe75852e2d 100644 --- a/mssql/tables/llx_bank_class.sql +++ b/mssql/tables/llx_bank_class.sql @@ -20,8 +20,8 @@ create table llx_bank_class ( - lineid int NOT NULL, - fk_categ int NOT NULL, + lineid integer NOT NULL, + fk_categ integer NOT NULL, ); CREATE INDEX lineid ON llx_bank_class(lineid) diff --git a/mssql/tables/llx_bank_url.sql b/mssql/tables/llx_bank_url.sql index 2a0da0f5426..ffc9af32cd0 100644 --- a/mssql/tables/llx_bank_url.sql +++ b/mssql/tables/llx_bank_url.sql @@ -23,9 +23,9 @@ create table llx_bank_url ( - rowid int IDENTITY PRIMARY KEY, - fk_bank int, - url_id int, + rowid integer IDENTITY PRIMARY KEY, + fk_bank integer, + url_id integer, url varchar(255), label varchar(255), type varchar(12) check (type in ('company','payment','member','subscription','donation','sc','payment_sc')) diff --git a/mssql/tables/llx_bookmark.sql b/mssql/tables/llx_bookmark.sql index b320ae91aa2..9d4e1119679 100644 --- a/mssql/tables/llx_bookmark.sql +++ b/mssql/tables/llx_bookmark.sql @@ -20,9 +20,9 @@ create table llx_bookmark ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int, - fk_user int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer, + fk_user integer NOT NULL, dateb datetime, url varchar(128) NOT NULL, target varchar(16), diff --git a/mssql/tables/llx_bookmark4u_login.sql b/mssql/tables/llx_bookmark4u_login.sql index 1c92d106e3d..9ff6a2d8b02 100644 --- a/mssql/tables/llx_bookmark4u_login.sql +++ b/mssql/tables/llx_bookmark4u_login.sql @@ -22,9 +22,9 @@ create table llx_bookmark4u_login ( - rowid int IDENTITY PRIMARY KEY, - fk_user int, - bk4u_uid int, + rowid integer IDENTITY PRIMARY KEY, + fk_user integer, + bk4u_uid integer, ); diff --git a/mssql/tables/llx_bordereau_cheque.sql b/mssql/tables/llx_bordereau_cheque.sql index 9fcd6e14ef0..b1a5173e4c9 100644 --- a/mssql/tables/llx_bordereau_cheque.sql +++ b/mssql/tables/llx_bordereau_cheque.sql @@ -5,16 +5,16 @@ -- $Source$ -- -- 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 +-- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 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. +-- GNU General Public License for more details. -- --- You should have received a copy of the GNU General [public] License +-- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- @@ -24,43 +24,14 @@ -- create table llx_bordereau_cheque ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, - date_bordereau datetime, - number varchar(5), - amount float(12), + date_bordereau SMALLDATETIME, + number integer, + amount float, nbcheque smallint DEFAULT 0, - fk_bank_account int, - fk_user_author int, + fk_bank_account integer, + fk_user_author integer, note text, statut tinyint DEFAULT 0 ); - -set ANSI_NULLS ON -set QUOTED_IDENTIFIER ON -GO - --- FILLZERO du number - -CREATE TRIGGER [dbo].[llx_bordereau_cheque_number] - ON [dbo].[llx_bordereau_cheque] - AFTER INSERT, UPDATE -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - - DECLARE @numero as varchar(5) - SELECT @numero = right('00000' + cast(number AS varchar(5)),5) - from llx_bordereau_cheque - where rowid in (select rowid from inserted) - -update llx_bordereau_cheque set number = @numero -where rowid in (select rowid from inserted) - -END - -set ANSI_NULLS ON -set QUOTED_IDENTIFIER ON -GO diff --git a/mssql/tables/llx_boxes.sql b/mssql/tables/llx_boxes.sql index 0a8cc49ead8..1f242814709 100644 --- a/mssql/tables/llx_boxes.sql +++ b/mssql/tables/llx_boxes.sql @@ -27,9 +27,9 @@ create table llx_boxes ( - rowid int IDENTITY PRIMARY KEY, - box_id int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + box_id integer NOT NULL, position smallint NOT NULL, box_order smallint default 0 NOT NULL, - fk_user int default 0 NOT NULL + fk_user integer default 0 NOT NULL ); diff --git a/mssql/tables/llx_boxes_def.sql b/mssql/tables/llx_boxes_def.sql index 21e7fdcd896..36ed2be9286 100644 --- a/mssql/tables/llx_boxes_def.sql +++ b/mssql/tables/llx_boxes_def.sql @@ -22,7 +22,7 @@ create table llx_boxes_def ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, name varchar(255) NOT NULL, [file] varchar(255) NOT NULL, note text diff --git a/mssql/tables/llx_c_actioncomm.sql b/mssql/tables/llx_c_actioncomm.sql index 2322fb2ca42..3f64ed5ca56 100644 --- a/mssql/tables/llx_c_actioncomm.sql +++ b/mssql/tables/llx_c_actioncomm.sql @@ -23,7 +23,7 @@ create table llx_c_actioncomm ( - id int PRIMARY KEY, + id integer PRIMARY KEY, code varchar(12) UNIQUE NOT NULL, type varchar(10) DEFAULT 'system' NOT NULL, libelle varchar(30) NOT NULL, diff --git a/mssql/tables/llx_c_ape.sql b/mssql/tables/llx_c_ape.sql index 64026f58b6c..a7f87cc28d3 100644 --- a/mssql/tables/llx_c_ape.sql +++ b/mssql/tables/llx_c_ape.sql @@ -23,7 +23,7 @@ create table llx_c_ape ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, code_ape varchar(5) NOT NULL, libelle varchar(255), active tinyint DEFAULT 1 NOT NULL, diff --git a/mssql/tables/llx_c_chargesociales.sql b/mssql/tables/llx_c_chargesociales.sql index 6909078c0f3..2eafb1a6ee7 100644 --- a/mssql/tables/llx_c_chargesociales.sql +++ b/mssql/tables/llx_c_chargesociales.sql @@ -23,7 +23,7 @@ create table llx_c_chargesociales ( - id int IDENTITY PRIMARY KEY, + id integer IDENTITY PRIMARY KEY, libelle varchar(80), deductible smallint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL diff --git a/mssql/tables/llx_c_civilite.sql b/mssql/tables/llx_c_civilite.sql index dca2204fb41..d9997621ac3 100644 --- a/mssql/tables/llx_c_civilite.sql +++ b/mssql/tables/llx_c_civilite.sql @@ -22,7 +22,7 @@ create table llx_c_civilite ( - rowid int PRIMARY KEY, + rowid integer PRIMARY KEY, code varchar(6) UNIQUE NOT NULL, civilite varchar(50), active tinyint DEFAULT 1 NOT NULL diff --git a/mssql/tables/llx_c_departements.sql b/mssql/tables/llx_c_departements.sql index ad2895c8839..494582999ec 100644 --- a/mssql/tables/llx_c_departements.sql +++ b/mssql/tables/llx_c_departements.sql @@ -23,11 +23,11 @@ create table llx_c_departements ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, code_departement varchar(6) NOT NULL, - fk_region int, + fk_region integer, cheflieu varchar(7), - tncc int, + tncc integer, ncc varchar(50), nom varchar(50), active tinyint DEFAULT 1 NOT NULL diff --git a/mssql/tables/llx_c_effectif.sql b/mssql/tables/llx_c_effectif.sql index 021dc59df84..49b44eeba5e 100644 --- a/mssql/tables/llx_c_effectif.sql +++ b/mssql/tables/llx_c_effectif.sql @@ -23,7 +23,7 @@ create table llx_c_effectif ( - id int PRIMARY KEY, + id integer PRIMARY KEY, code varchar(12) UNIQUE NOT NULL, libelle varchar(30), active tinyint DEFAULT 1 NOT NULL diff --git a/mssql/tables/llx_c_forme_juridique.sql b/mssql/tables/llx_c_forme_juridique.sql index 100372d8d74..ef13731c4a2 100644 --- a/mssql/tables/llx_c_forme_juridique.sql +++ b/mssql/tables/llx_c_forme_juridique.sql @@ -23,9 +23,9 @@ create table llx_c_forme_juridique ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, code varchar(12) UNIQUE NOT NULL, - fk_pays int NOT NULL, + fk_pays integer NOT NULL, libelle varchar(255), active tinyint DEFAULT 1 NOT NULL diff --git a/mssql/tables/llx_c_methode_commande_fournisseur.sql b/mssql/tables/llx_c_methode_commande_fournisseur.sql index 4372743980a..90accaeb882 100644 --- a/mssql/tables/llx_c_methode_commande_fournisseur.sql +++ b/mssql/tables/llx_c_methode_commande_fournisseur.sql @@ -23,7 +23,7 @@ create table llx_c_methode_commande_fournisseur ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, code varchar(30), libelle varchar(60), active tinyint default 1 NOT NULL, diff --git a/mssql/tables/llx_c_paiement.sql b/mssql/tables/llx_c_paiement.sql index 3fa39a33f0a..ae89ad55732 100644 --- a/mssql/tables/llx_c_paiement.sql +++ b/mssql/tables/llx_c_paiement.sql @@ -29,7 +29,7 @@ create table llx_c_paiement ( - id int PRIMARY KEY, + id integer PRIMARY KEY, code varchar(6) UNIQUE NOT NULL, libelle varchar(30), type smallint, diff --git a/mssql/tables/llx_c_pays.sql b/mssql/tables/llx_c_pays.sql index 496a15319ec..4710f2c8089 100644 --- a/mssql/tables/llx_c_pays.sql +++ b/mssql/tables/llx_c_pays.sql @@ -23,7 +23,7 @@ create table llx_c_pays ( - rowid int PRIMARY KEY, + rowid integer PRIMARY KEY, code varchar(2) NOT NULL, code_iso varchar(3) , libelle varchar(50) NOT NULL, diff --git a/mssql/tables/llx_c_regions.sql b/mssql/tables/llx_c_regions.sql index 63a7722d476..9f5d3bdc2a6 100644 --- a/mssql/tables/llx_c_regions.sql +++ b/mssql/tables/llx_c_regions.sql @@ -23,11 +23,11 @@ create table llx_c_regions ( - rowid int IDENTITY PRIMARY KEY, - code_region int UNIQUE NOT NULL, - fk_pays int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + code_region integer UNIQUE NOT NULL, + fk_pays integer NOT NULL, cheflieu varchar(7), - tncc int, + tncc integer, nom varchar(50), active tinyint DEFAULT 1 NOT NULL ); diff --git a/mssql/tables/llx_c_stcomm.sql b/mssql/tables/llx_c_stcomm.sql index d5f284163ae..e50640e038d 100644 --- a/mssql/tables/llx_c_stcomm.sql +++ b/mssql/tables/llx_c_stcomm.sql @@ -23,7 +23,7 @@ create table llx_c_stcomm ( - id int PRIMARY KEY, + id integer PRIMARY KEY, code varchar(12) UNIQUE NOT NULL, libelle varchar(30), active tinyint default 1 NOT NULL diff --git a/mssql/tables/llx_c_tva.sql b/mssql/tables/llx_c_tva.sql index dd78dca40bf..a87cce86004 100644 --- a/mssql/tables/llx_c_tva.sql +++ b/mssql/tables/llx_c_tva.sql @@ -22,10 +22,10 @@ create table llx_c_tva ( - rowid int NOT NULL IDENTITY PRIMARY KEY, - fk_pays int NOT NULL, + rowid integer NOT NULL IDENTITY PRIMARY KEY, + fk_pays integer NOT NULL, taux FLOAT(25) NOT NULL, - recuperableonly int NOT NULL DEFAULT 0, + recuperableonly integer NOT NULL DEFAULT 0, note varchar(128), active tinyint DEFAULT 1 NOT NULL diff --git a/mssql/tables/llx_c_type_contact.sql b/mssql/tables/llx_c_type_contact.sql index 6bdb1ca4565..f5326d1f7a4 100644 --- a/mssql/tables/llx_c_type_contact.sql +++ b/mssql/tables/llx_c_type_contact.sql @@ -32,7 +32,7 @@ create table llx_c_type_contact ( - rowid int PRIMARY KEY, + rowid integer PRIMARY KEY, element varchar(30) NOT NULL, source varchar(8) DEFAULT 'external' NOT NULL, code varchar(16) NOT NULL, diff --git a/mssql/tables/llx_c_typent.sql b/mssql/tables/llx_c_typent.sql index c8a27242560..67658ee20d5 100644 --- a/mssql/tables/llx_c_typent.sql +++ b/mssql/tables/llx_c_typent.sql @@ -23,7 +23,7 @@ create table llx_c_typent ( - id int PRIMARY KEY, + id integer PRIMARY KEY, code varchar(12) UNIQUE NOT NULL, libelle varchar(30), active tinyint DEFAULT 1 NOT NULL diff --git a/mssql/tables/llx_categorie.sql b/mssql/tables/llx_categorie.sql index 0e4883f788e..0c11509c5e3 100644 --- a/mssql/tables/llx_categorie.sql +++ b/mssql/tables/llx_categorie.sql @@ -24,7 +24,7 @@ create table llx_categorie ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, label VARCHAR(255), -- nom de la catégorie description text, -- description de la catégorie visible tinyint DEFAULT 1 NOT NULL -- determine si les produits sont visible ou pas diff --git a/mssql/tables/llx_categorie_association.sql b/mssql/tables/llx_categorie_association.sql index 8f636a9392b..ce6b53e0122 100644 --- a/mssql/tables/llx_categorie_association.sql +++ b/mssql/tables/llx_categorie_association.sql @@ -20,6 +20,6 @@ create table llx_categorie_association ( - fk_categorie_mere int NOT NULL, - fk_categorie_fille int NOT NULL + fk_categorie_mere integer NOT NULL, + fk_categorie_fille integer NOT NULL ); diff --git a/mssql/tables/llx_categorie_fournisseur.sql b/mssql/tables/llx_categorie_fournisseur.sql index 4902c9e8b77..bf997c20a51 100644 --- a/mssql/tables/llx_categorie_fournisseur.sql +++ b/mssql/tables/llx_categorie_fournisseur.sql @@ -22,7 +22,7 @@ create table llx_categorie_fournisseur ( - fk_categorie int NOT NULL, - fk_societe int NOT NULL, + fk_categorie integer NOT NULL, + fk_societe integer NOT NULL, UNIQUE (fk_categorie, fk_societe) ); diff --git a/mssql/tables/llx_categorie_product.sql b/mssql/tables/llx_categorie_product.sql index 8f09559999a..ce6c9b6824b 100644 --- a/mssql/tables/llx_categorie_product.sql +++ b/mssql/tables/llx_categorie_product.sql @@ -20,6 +20,6 @@ create table llx_categorie_product ( - fk_categorie int NOT NULL, - fk_product int NOT NULL + fk_categorie integer NOT NULL, + fk_product integer NOT NULL ); diff --git a/mssql/tables/llx_chargesociales.sql b/mssql/tables/llx_chargesociales.sql index 508897ab745..01f877ab1ca 100644 --- a/mssql/tables/llx_chargesociales.sql +++ b/mssql/tables/llx_chargesociales.sql @@ -22,10 +22,10 @@ create table llx_chargesociales ( - rowid int IDENTITY PRIMARY KEY, - date_ech datetime NOT NULL, -- date d'echeance + rowid integer IDENTITY PRIMARY KEY, + date_ech datetime NOT NULL, -- SMALLDATETIME d'echeance libelle varchar(80), - fk_type int, + fk_type integer, amount real default 0 NOT NULL, paye smallint default 0 NOT NULL, periode datetime diff --git a/mssql/tables/llx_co_fa.sql b/mssql/tables/llx_co_fa.sql index 1f9557c6970..46a14588d28 100644 --- a/mssql/tables/llx_co_fa.sql +++ b/mssql/tables/llx_co_fa.sql @@ -21,9 +21,9 @@ create table llx_co_fa ( - rowid int IDENTITY PRIMARY KEY, - fk_commande int NOT NULL, - fk_facture int NOT NULL + rowid integer IDENTITY PRIMARY KEY, + fk_commande integer NOT NULL, + fk_facture integer NOT NULL --key(fk_commande), --key(fk_facture) diff --git a/mssql/tables/llx_co_pr.sql b/mssql/tables/llx_co_pr.sql index c22e4898d63..7d89659ddb6 100644 --- a/mssql/tables/llx_co_pr.sql +++ b/mssql/tables/llx_co_pr.sql @@ -21,7 +21,7 @@ create table llx_co_pr ( - rowid int IDENTITY PRIMARY KEY, - fk_commande int, - fk_propale int + rowid integer IDENTITY PRIMARY KEY, + fk_commande integer, + fk_propale integer ); diff --git a/mssql/tables/llx_comfourn_facfourn.sql b/mssql/tables/llx_comfourn_facfourn.sql index 9209b2e3fe6..cf9934b9bf5 100644 --- a/mssql/tables/llx_comfourn_facfourn.sql +++ b/mssql/tables/llx_comfourn_facfourn.sql @@ -22,9 +22,9 @@ create table llx_comfourn_facfourn ( - rowid int IDENTITY PRIMARY KEY, - fk_commande int NOT NULL, - fk_facture int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_commande integer NOT NULL, + fk_facture integer NOT NULL, ); diff --git a/mssql/tables/llx_commande.key.sql b/mssql/tables/llx_commande.key.sql index d2530445a11..36f0a8b4c93 100644 --- a/mssql/tables/llx_commande.key.sql +++ b/mssql/tables/llx_commande.key.sql @@ -26,4 +26,4 @@ CREATE INDEX idx_commande_fk_soc ON llx_commande(fk_soc); -ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); diff --git a/mssql/tables/llx_commande.sql b/mssql/tables/llx_commande.sql index 1f0fcf67773..e9bfebc2d84 100644 --- a/mssql/tables/llx_commande.sql +++ b/mssql/tables/llx_commande.sql @@ -22,20 +22,20 @@ create table llx_commande ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - fk_soc int NOT NULL, - fk_projet int DEFAULT 0, -- projet auquel est rattache la commande + fk_soc integer NOT NULL, + fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande ref varchar(30) NOT NULL, -- order number ref_client varchar(30), -- customer order number - date_creation datetime, -- date de creation - date_valid datetime, -- date de validation - date_cloture datetime, -- date de cloture - date_commande datetime, -- date de la commande - fk_user_author int, -- createur de la commande - fk_user_valid int, -- valideur de la commande - fk_user_cloture int, -- auteur cloture + date_creation datetime, -- SMALLDATETIME de creation + date_valid datetime, -- SMALLDATETIME de validation + date_cloture datetime, -- SMALLDATETIME de cloture + date_commande datetime, -- SMALLDATETIME de la commande + fk_user_author integer, -- createur de la commande + fk_user_valid integer, -- valideur de la commande + fk_user_cloture integer, -- auteur cloture source smallint NOT NULL, fk_statut smallint default 0, amount_ht real default 0, @@ -50,10 +50,10 @@ create table llx_commande model_pdf varchar(50), facture tinyint default 0, - fk_cond_reglement int, -- condition de réglement - fk_mode_reglement int, -- mode de réglement + fk_cond_reglement integer, -- condition de réglement + fk_mode_reglement integer, -- mode de réglement date_livraison datetime default NULL, - fk_adresse_livraison int, -- adresse de livraison + fk_adresse_livraison integer, -- adresse de livraison ); diff --git a/mssql/tables/llx_commande_fournisseur.key.sql b/mssql/tables/llx_commande_fournisseur.key.sql index 639160218f9..7ed4780211a 100644 --- a/mssql/tables/llx_commande_fournisseur.key.sql +++ b/mssql/tables/llx_commande_fournisseur.key.sql @@ -26,4 +26,4 @@ CREATE INDEX idx_commande_fournisseur_fk_soc ON llx_commande_fournisseur(fk_soc); -ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); diff --git a/mssql/tables/llx_commande_fournisseur.sql b/mssql/tables/llx_commande_fournisseur.sql index 154a70b68ae..c268dc232bd 100644 --- a/mssql/tables/llx_commande_fournisseur.sql +++ b/mssql/tables/llx_commande_fournisseur.sql @@ -22,19 +22,19 @@ create table llx_commande_fournisseur ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - fk_soc int NOT NULL, - fk_projet int DEFAULT 0, -- projet auquel est rattache la commande + fk_soc integer NOT NULL, + fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande ref varchar(30) NOT NULL, -- order number - date_creation datetime, -- date de creation - date_valid datetime, -- date de validation - date_cloture datetime, -- date de cloture - date_commande datetime, -- date de la commande - fk_user_author int, -- createur de la commande - fk_user_valid int, -- valideur de la commande - fk_user_cloture int, -- auteur cloture + date_creation datetime, -- SMALLDATETIME de creation + date_valid datetime, -- SMALLDATETIME de validation + date_cloture datetime, -- SMALLDATETIME de cloture + date_commande datetime, -- SMALLDATETIME de la commande + fk_user_author integer, -- createur de la commande + fk_user_valid integer, -- valideur de la commande + fk_user_cloture integer, -- auteur cloture source smallint NOT NULL, fk_statut smallint default 0, amount_ht real default 0, @@ -47,7 +47,7 @@ create table llx_commande_fournisseur note_public text, model_pdf varchar(50), - fk_methode_commande int default 0, + fk_methode_commande integer default 0, ); diff --git a/mssql/tables/llx_commande_fournisseur_dispatch.sql b/mssql/tables/llx_commande_fournisseur_dispatch.sql index 1d1e41b5dd3..b01022f5122 100644 --- a/mssql/tables/llx_commande_fournisseur_dispatch.sql +++ b/mssql/tables/llx_commande_fournisseur_dispatch.sql @@ -21,11 +21,11 @@ create table llx_commande_fournisseur_dispatch ( - rowid int IDENTITY PRIMARY KEY, - fk_commande int, - fk_product int, + rowid integer IDENTITY PRIMARY KEY, + fk_commande integer, + fk_product integer, qty float, -- quantité - fk_entrepot int, - fk_user int, + fk_entrepot integer, + fk_user integer, datec datetime ); diff --git a/mssql/tables/llx_commande_fournisseur_log.sql b/mssql/tables/llx_commande_fournisseur_log.sql index bc4f5d4a4e6..f848028f9b3 100644 --- a/mssql/tables/llx_commande_fournisseur_log.sql +++ b/mssql/tables/llx_commande_fournisseur_log.sql @@ -22,10 +22,10 @@ create table llx_commande_fournisseur_log ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, datelog datetime NOT NULL, - fk_commande int NOT NULL, + fk_commande integer NOT NULL, fk_statut smallint NOT NULL, - fk_user int NOT NULL + fk_user integer NOT NULL ); diff --git a/mssql/tables/llx_commande_fournisseurdet.sql b/mssql/tables/llx_commande_fournisseurdet.sql index 93bc461e6a0..920810fd3dd 100644 --- a/mssql/tables/llx_commande_fournisseurdet.sql +++ b/mssql/tables/llx_commande_fournisseurdet.sql @@ -21,9 +21,9 @@ create table llx_commande_fournisseurdet ( - rowid int IDENTITY PRIMARY KEY, - fk_commande int, - fk_product int, + rowid integer IDENTITY PRIMARY KEY, + fk_commande integer, + fk_product integer, ref varchar(50), label varchar(255), description text, diff --git a/mssql/tables/llx_commandedet.sql b/mssql/tables/llx_commandedet.sql index 722e1444665..60afe850536 100644 --- a/mssql/tables/llx_commandedet.sql +++ b/mssql/tables/llx_commandedet.sql @@ -22,24 +22,24 @@ create table llx_commandedet ( - rowid int IDENTITY PRIMARY KEY, - fk_commande int, - fk_product int, + rowid integer IDENTITY PRIMARY KEY, + fk_commande integer, + fk_product integer, description text, tva_tx real, -- taux tva qty real, -- quantité remise_percent real DEFAULT 0, -- pourcentage de remise remise real DEFAULT 0, -- montant de la remise - fk_remise_except int NULL, -- Lien vers table des remises fixes + fk_remise_except integer NULL, -- Lien vers table des remises fixes subprice real, -- prix avant remise price real, -- prix final total_ht real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale total_tva real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale total_ttc real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale - info_bits int DEFAULT 0, -- TVA NPR ou non + info_bits integer DEFAULT 0, -- TVA NPR ou non coef real, -- coefficient de marge special_code tinyint DEFAULT 0, -- code pour les lignes speciales - rang int DEFAULT 0 + rang integer DEFAULT 0 ); -- diff --git a/mssql/tables/llx_compta.sql b/mssql/tables/llx_compta.sql index e4b78828f42..3c5937aa600 100644 --- a/mssql/tables/llx_compta.sql +++ b/mssql/tables/llx_compta.sql @@ -22,14 +22,14 @@ create table llx_compta ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, - datev datetime, -- date de valeur + datev datetime, -- SMALLDATETIME de valeur amount real DEFAULT 0 NOT NULL , label varchar(255), - fk_compta_account int, - fk_user_author int, - fk_user_valid int, + fk_compta_account integer, + fk_user_author integer, + fk_user_valid integer, valid tinyint DEFAULT 0, note text diff --git a/mssql/tables/llx_compta_account.sql b/mssql/tables/llx_compta_account.sql index 89c77a73ea4..d9cb51ac0a3 100644 --- a/mssql/tables/llx_compta_account.sql +++ b/mssql/tables/llx_compta_account.sql @@ -22,11 +22,11 @@ create table llx_compta_account ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, number varchar(12), label varchar(255), - fk_user_author int, + fk_user_author integer, note text ); diff --git a/mssql/tables/llx_compta_compte_generaux.sql b/mssql/tables/llx_compta_compte_generaux.sql index 485bebdaee3..7757dfd271a 100644 --- a/mssql/tables/llx_compta_compte_generaux.sql +++ b/mssql/tables/llx_compta_compte_generaux.sql @@ -22,11 +22,11 @@ create table llx_compta_compte_generaux ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, date_creation datetime, numero varchar(50), intitule varchar(255), - fk_user_author int, + fk_user_author integer, note text, UNIQUE(numero) diff --git a/mssql/tables/llx_cond_reglement.sql b/mssql/tables/llx_cond_reglement.sql index 7c80fb9e9fe..2d932693566 100644 --- a/mssql/tables/llx_cond_reglement.sql +++ b/mssql/tables/llx_cond_reglement.sql @@ -22,7 +22,7 @@ create table llx_cond_reglement ( - rowid int PRIMARY KEY, + rowid integer PRIMARY KEY, code varchar(16), sortorder smallint, active tinyint DEFAULT 1, diff --git a/mssql/tables/llx_const.sql b/mssql/tables/llx_const.sql index 9be593fc60e..605aa86057d 100644 --- a/mssql/tables/llx_const.sql +++ b/mssql/tables/llx_const.sql @@ -26,7 +26,7 @@ create table llx_const ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, name varchar(255), value text, -- max 65535 caracteres type varchar(6) check (type in ('yesno','texte','chaine')), diff --git a/mssql/tables/llx_contrat.key.sql b/mssql/tables/llx_contrat.key.sql index bf0bd666953..1c2bdda763a 100644 --- a/mssql/tables/llx_contrat.key.sql +++ b/mssql/tables/llx_contrat.key.sql @@ -30,5 +30,5 @@ CREATE INDEX idx_contrat_fk_soc ON llx_contrat(fk_soc); CREATE INDEX idx_contrat_fk_user_author ON llx_contrat(fk_user_author); -ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); \ No newline at end of file diff --git a/mssql/tables/llx_contrat.sql b/mssql/tables/llx_contrat.sql index e4eb86d7f9e..09c8419a00a 100644 --- a/mssql/tables/llx_contrat.sql +++ b/mssql/tables/llx_contrat.sql @@ -23,22 +23,22 @@ create table llx_contrat ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, ref varchar(30), -- reference de contrat tms timestamp, - datec datetime, -- date de creation de l'enregistrement + datec datetime, -- SMALLDATETIME de creation de l'enregistrement date_contrat datetime, statut smallint DEFAULT 0, mise_en_service datetime, fin_validite datetime, date_cloture datetime, - fk_soc int NOT NULL, - fk_projet int, - fk_commercial_signature int NOT NULL, -- obsolete - fk_commercial_suivi int NOT NULL, -- obsolete - fk_user_author int NOT NULL default 0, - fk_user_mise_en_service int, - fk_user_cloture int, + fk_soc integer NOT NULL, + fk_projet integer, + fk_commercial_signature integer NOT NULL, -- obsolete + fk_commercial_suivi integer NOT NULL, -- obsolete + fk_user_author integer NOT NULL default 0, + fk_user_mise_en_service integer, + fk_user_cloture integer, note text, note_public text ); diff --git a/mssql/tables/llx_contratdet.sql b/mssql/tables/llx_contratdet.sql index 87cc79bf4f8..6cbda8b953e 100644 --- a/mssql/tables/llx_contratdet.sql +++ b/mssql/tables/llx_contratdet.sql @@ -22,11 +22,11 @@ create table llx_contratdet ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - fk_contrat int NOT NULL, - fk_product int NULL, -- doit pouvoir etre nul pour ligne detail sans produits + fk_contrat integer NOT NULL, + fk_product integer NULL, -- doit pouvoir etre nul pour ligne detail sans produits statut smallint DEFAULT 0, @@ -35,7 +35,7 @@ create table llx_contratdet date_commande datetime, date_ouverture_prevue datetime, - date_ouverture datetime, -- date d'ouverture du service chez le client + date_ouverture datetime, -- SMALLDATETIME d'ouverture du service chez le client date_fin_validite datetime, date_cloture datetime, @@ -43,17 +43,17 @@ create table llx_contratdet qty real, -- quantité remise_percent real DEFAULT 0, -- pourcentage de remise remise real DEFAULT 0, -- montant de la remise - fk_remise_except int NULL, -- Lien vers table des remises fixes + fk_remise_except integer NULL, -- Lien vers table des remises fixes subprice real, -- prix avant remise price_ht real, -- prix final total_ht real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale total_tva real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale total_ttc real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale - info_bits int DEFAULT 0, -- TVA NPR ou non + info_bits integer DEFAULT 0, -- TVA NPR ou non - fk_user_author int NOT NULL default 0, - fk_user_ouverture int, - fk_user_cloture int, + fk_user_author integer NOT NULL default 0, + fk_user_ouverture integer, + fk_user_cloture integer, commentaire text ); diff --git a/mssql/tables/llx_contratdet_log.key.sql b/mssql/tables/llx_contratdet_log.key.sql index 3e333fd75d0..a20a4c0ce21 100644 --- a/mssql/tables/llx_contratdet_log.key.sql +++ b/mssql/tables/llx_contratdet_log.key.sql @@ -21,6 +21,6 @@ -- ============================================================================ CREATE INDEX idx_contratdet_log_fk_contratdet ON llx_contratdet_log(fk_contratdet); -CREATE INDEX idx_contratdet_log_date ON llx_contratdet_log(date); +CREATE INDEX idx_contratdet_log_date ON llx_contratdet_log(SMALLDATETIME); ALTER TABLE llx_contratdet_log ADD CONSTRAINT fk_contratdet_log_fk_contratdet FOREIGN KEY (fk_contratdet) REFERENCES llx_contratdet (rowid); diff --git a/mssql/tables/llx_contratdet_log.sql b/mssql/tables/llx_contratdet_log.sql index bb5e0ae2fb2..8bc9f8bcf17 100644 --- a/mssql/tables/llx_contratdet_log.sql +++ b/mssql/tables/llx_contratdet_log.sql @@ -22,12 +22,12 @@ create table llx_contratdet_log ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - fk_contratdet int NOT NULL, - date datetime NOT NULL, + fk_contratdet integer NOT NULL, + SMALLDATETIME datetime NOT NULL, statut smallint NOT NULL, - fk_user_author int NOT NULL, + fk_user_author integer NOT NULL, commentaire text ); diff --git a/mssql/tables/llx_cotisation.sql b/mssql/tables/llx_cotisation.sql index cbf7d4b53cf..93e6e73e98a 100644 --- a/mssql/tables/llx_cotisation.sql +++ b/mssql/tables/llx_cotisation.sql @@ -21,12 +21,12 @@ create table llx_cotisation ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, datec datetime, - fk_adherent int, + fk_adherent integer, dateadh datetime, cotisation real, - fk_bank int DEFAULT NULL, + fk_bank integer DEFAULT NULL, note text ); diff --git a/mssql/tables/llx_deplacement.sql b/mssql/tables/llx_deplacement.sql index db4e4a8c931..0ba69e73b90 100644 --- a/mssql/tables/llx_deplacement.sql +++ b/mssql/tables/llx_deplacement.sql @@ -22,14 +22,14 @@ create table llx_deplacement ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime NOT NULL, tms timestamp, dated datetime, - fk_user int NOT NULL, - fk_user_author int, + fk_user integer NOT NULL, + fk_user_author integer, type smallint NOT NULL, km smallint, - fk_soc int, + fk_soc integer, note text ); diff --git a/mssql/tables/llx_document.sql b/mssql/tables/llx_document.sql index bbb553da8e9..f7cad81d43f 100644 --- a/mssql/tables/llx_document.sql +++ b/mssql/tables/llx_document.sql @@ -21,13 +21,13 @@ create table llx_document ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, name varchar(255) NOT NULL, file_name varchar(255) NOT NULL, file_extension varchar(5) NOT NULL, date_generation datetime NULL, - fk_owner int NULL, - fk_group int NULL, + fk_owner integer NULL, + fk_group integer NULL, permissions char(9) DEFAULT 'rw-rw-rw' ); diff --git a/mssql/tables/llx_document_generator.sql b/mssql/tables/llx_document_generator.sql index df3f59cf041..e8c08eb932a 100644 --- a/mssql/tables/llx_document_generator.sql +++ b/mssql/tables/llx_document_generator.sql @@ -21,7 +21,7 @@ create table llx_document_generator ( - rowid int NOT NULL PRIMARY KEY, + rowid integer NOT NULL PRIMARY KEY, name varchar(255) NOT NULL, classfile varchar(255) NOT NULL, class varchar(255) NOT NULL diff --git a/mssql/tables/llx_document_model.sql b/mssql/tables/llx_document_model.sql index 23338ee8360..7bd9972695f 100644 --- a/mssql/tables/llx_document_model.sql +++ b/mssql/tables/llx_document_model.sql @@ -25,7 +25,7 @@ create table llx_document_model ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, nom varchar(50), type varchar(20) NOT NULL, libelle varchar(255), diff --git a/mssql/tables/llx_dolibarr_modules.sql b/mssql/tables/llx_dolibarr_modules.sql index 489b43ddce3..2dbc9741011 100644 --- a/mssql/tables/llx_dolibarr_modules.sql +++ b/mssql/tables/llx_dolibarr_modules.sql @@ -22,7 +22,7 @@ create table llx_dolibarr_modules ( - numero int PRIMARY KEY, + numero integer PRIMARY KEY, active tinyint DEFAULT 0 NOT NULL, active_date datetime NOT NULL, active_version varchar(25) NOT NULL diff --git a/mssql/tables/llx_domain.sql b/mssql/tables/llx_domain.sql index 5e8aaf2b32e..14d4ba433f2 100644 --- a/mssql/tables/llx_domain.sql +++ b/mssql/tables/llx_domain.sql @@ -22,7 +22,7 @@ create table llx_domain ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, label varchar(255), note text diff --git a/mssql/tables/llx_don.sql b/mssql/tables/llx_don.sql index e2a7837bbcd..77033f5fb1c 100644 --- a/mssql/tables/llx_don.sql +++ b/mssql/tables/llx_don.sql @@ -22,13 +22,13 @@ create table llx_don ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY 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 datetime, -- SMALLDATETIME de création de l'enregistrement + datedon datetime, -- SMALLDATETIME du don/promesse amount real DEFAULT 0, - fk_paiement int, + fk_paiement integer, prenom varchar(50), nom varchar(50), societe varchar(50), @@ -38,8 +38,8 @@ create table llx_don pays varchar(50), email varchar(255), [public] smallint DEFAULT 1 NOT NULL, -- le don est-il [public] (0,1) - fk_don_projet int NOT NULL, -- projet auquel est fait le don - fk_user_author int NOT NULL, - fk_user_valid int NOT NULL, + fk_don_projet integer NOT NULL, -- projet auquel est fait le don + fk_user_author integer NOT NULL, + fk_user_valid integer NOT NULL, note text ); diff --git a/mssql/tables/llx_don_projet.sql b/mssql/tables/llx_don_projet.sql index dac400a5e7c..7cb61cd2109 100644 --- a/mssql/tables/llx_don_projet.sql +++ b/mssql/tables/llx_don_projet.sql @@ -22,10 +22,10 @@ create table llx_don_projet ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, datec datetime, libelle varchar(255), - fk_user_author int NOT NULL, + fk_user_author integer NOT NULL, note text ); diff --git a/mssql/tables/llx_element_contact.sql b/mssql/tables/llx_element_contact.sql index 6ca44ee9920..79eaf22190a 100644 --- a/mssql/tables/llx_element_contact.sql +++ b/mssql/tables/llx_element_contact.sql @@ -25,12 +25,12 @@ create table llx_element_contact ( - rowid int IDENTITY PRIMARY KEY, - datecreate datetime NULL, -- date de creation de l'enregistrement + rowid integer IDENTITY PRIMARY KEY, + datecreate datetime NULL, -- SMALLDATETIME de creation de l'enregistrement statut smallint DEFAULT 5, -- 5 inactif, 4 actif - element_id int NOT NULL, -- la reference de l'element. - fk_c_type_contact int NOT NULL, -- nature du contact. - fk_socpeople int NOT NULL + element_id integer NOT NULL, -- la reference de l'element. + fk_c_type_contact integer NOT NULL, -- nature du contact. + fk_socpeople integer NOT NULL ); diff --git a/mssql/tables/llx_energie_compteur.sql b/mssql/tables/llx_energie_compteur.sql index 0d1436b7fbe..c7ee32b5e48 100644 --- a/mssql/tables/llx_energie_compteur.sql +++ b/mssql/tables/llx_energie_compteur.sql @@ -22,11 +22,11 @@ create table llx_energie_compteur ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, libelle varchar(50), - fk_energie int NOT NULL, + fk_energie integer NOT NULL, datec datetime, - fk_user_author int NOT NULL, + fk_user_author integer NOT NULL, note text ); diff --git a/mssql/tables/llx_energie_compteur_groupe.sql b/mssql/tables/llx_energie_compteur_groupe.sql index 58ec0fbcf27..29865db2b57 100644 --- a/mssql/tables/llx_energie_compteur_groupe.sql +++ b/mssql/tables/llx_energie_compteur_groupe.sql @@ -22,6 +22,6 @@ create table llx_energie_compteur_groupe ( - fk_energie_compteur int NOT NULL, - fk_energie_groupe int NOT NULL + fk_energie_compteur integer NOT NULL, + fk_energie_groupe integer NOT NULL ); diff --git a/mssql/tables/llx_energie_compteur_releve.sql b/mssql/tables/llx_energie_compteur_releve.sql index 2ceb761dc46..e82ba02d023 100644 --- a/mssql/tables/llx_energie_compteur_releve.sql +++ b/mssql/tables/llx_energie_compteur_releve.sql @@ -22,12 +22,12 @@ create table llx_energie_compteur_releve ( - rowid int IDENTITY PRIMARY KEY, - fk_compteur int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_compteur integer NOT NULL, date_releve datetime, valeur real, datec datetime, - fk_user_author int NOT NULL, + fk_user_author integer NOT NULL, note text ); diff --git a/mssql/tables/llx_energie_groupe.sql b/mssql/tables/llx_energie_groupe.sql index 54f36c4cd55..b8cbfd8bd1e 100644 --- a/mssql/tables/llx_energie_groupe.sql +++ b/mssql/tables/llx_energie_groupe.sql @@ -22,10 +22,10 @@ create table llx_energie_groupe ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, libelle varchar(100), datec datetime, - fk_user_author int NOT NULL, + fk_user_author integer NOT NULL, note text ); diff --git a/mssql/tables/llx_entrepot.sql b/mssql/tables/llx_entrepot.sql index 80d3d1ae889..58a842af233 100644 --- a/mssql/tables/llx_entrepot.sql +++ b/mssql/tables/llx_entrepot.sql @@ -23,7 +23,7 @@ create table llx_entrepot ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, label varchar(255) UNIQUE NOT NULL, @@ -32,9 +32,9 @@ create table llx_entrepot address varchar(255), cp varchar(10), ville varchar(50), - fk_pays int DEFAULT 0, + fk_pays integer DEFAULT 0, statut tinyint DEFAULT 1, -- 1 ouvert, 0 fermé valo_pmp float(12), -- valoristaion du stock en PMP - fk_user_author int + fk_user_author integer ); diff --git a/mssql/tables/llx_entrepot_valorisation.sql b/mssql/tables/llx_entrepot_valorisation.sql index 504901481ad..5285e61b7e7 100644 --- a/mssql/tables/llx_entrepot_valorisation.sql +++ b/mssql/tables/llx_entrepot_valorisation.sql @@ -22,10 +22,10 @@ create table llx_entrepot_valorisation ( - rowid int IDENTITY PRIMARY KEY, - tms timestamp, -- date technique mise à jour automatiquement - date_calcul datetime, -- date auquel a ete calcule la valeur - fk_entrepot int NOT NULL , + rowid integer IDENTITY PRIMARY KEY, + tms timestamp, -- SMALLDATETIME technique mise à jour automatiquement + date_calcul datetime, -- SMALLDATETIME auquel a ete calcule la valeur + fk_entrepot integer NOT NULL , valo_pmp float(12) -- valoristaion du stock en PMP --key(fk_entrepot) ); diff --git a/mssql/tables/llx_expedition.sql b/mssql/tables/llx_expedition.sql index 5201452b6fb..2f6561a4682 100644 --- a/mssql/tables/llx_expedition.sql +++ b/mssql/tables/llx_expedition.sql @@ -22,17 +22,17 @@ create table llx_expedition ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, ref varchar(30) NOT NULL, - fk_commande int, - date_creation datetime, -- date de creation - date_valid datetime, -- date de validation - date_expedition datetime, -- date de l'expedition - fk_user_author int, -- createur - fk_user_valid int, -- valideur - fk_entrepot int, - fk_expedition_methode int, + fk_commande integer, + date_creation datetime, -- SMALLDATETIME de creation + date_valid datetime, -- SMALLDATETIME de validation + date_expedition datetime, -- SMALLDATETIME de l'expedition + fk_user_author integer, -- createur + fk_user_valid integer, -- valideur + fk_entrepot integer, + fk_expedition_methode integer, fk_statut smallint DEFAULT 0, note text, model_pdf varchar(50) diff --git a/mssql/tables/llx_expedition_methode.sql b/mssql/tables/llx_expedition_methode.sql index ef07cb830f0..a7dbced8838 100644 --- a/mssql/tables/llx_expedition_methode.sql +++ b/mssql/tables/llx_expedition_methode.sql @@ -22,7 +22,7 @@ create table llx_expedition_methode ( - rowid int PRIMARY KEY, + rowid integer PRIMARY KEY, tms timestamp, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, diff --git a/mssql/tables/llx_expeditiondet.sql b/mssql/tables/llx_expeditiondet.sql index 8ec1c445ecd..e4b8432bfd2 100644 --- a/mssql/tables/llx_expeditiondet.sql +++ b/mssql/tables/llx_expeditiondet.sql @@ -21,9 +21,9 @@ create table llx_expeditiondet ( - rowid int IDENTITY PRIMARY KEY, - fk_expedition int NOT NULL, - fk_commande_ligne int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_expedition integer NOT NULL, + fk_commande_ligne integer NOT NULL, qty real -- quantité -- key(fk_expedition), diff --git a/mssql/tables/llx_export_compta.sql b/mssql/tables/llx_export_compta.sql index 10dc663853c..3adc3479329 100644 --- a/mssql/tables/llx_export_compta.sql +++ b/mssql/tables/llx_export_compta.sql @@ -23,10 +23,10 @@ create table llx_export_compta ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, ref varchar(12) NOT NULL, - date_export datetime NOT NULL, -- date de creation - fk_user int NOT NULL, + date_export datetime NOT NULL, -- SMALLDATETIME de creation + fk_user integer NOT NULL, note text ); diff --git a/mssql/tables/llx_export_model.sql b/mssql/tables/llx_export_model.sql index d7c3c42ba0c..87fb7997250 100644 --- a/mssql/tables/llx_export_model.sql +++ b/mssql/tables/llx_export_model.sql @@ -25,8 +25,8 @@ create table llx_export_model ( - rowid int IDENTITY PRIMARY KEY, - fk_user int DEFAULT 0 NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_user integer DEFAULT 0 NOT NULL, label varchar(50) NOT NULL, type varchar(20) NOT NULL, field text NOT NULL diff --git a/mssql/tables/llx_fa_pr.sql b/mssql/tables/llx_fa_pr.sql index e40d3a7add0..9b74831cd4f 100644 --- a/mssql/tables/llx_fa_pr.sql +++ b/mssql/tables/llx_fa_pr.sql @@ -21,7 +21,7 @@ create table llx_fa_pr ( - rowid int IDENTITY PRIMARY KEY, - fk_facture int, - fk_propal int + rowid integer IDENTITY PRIMARY KEY, + fk_facture integer, + fk_propal integer ); diff --git a/mssql/tables/llx_facture.key.sql b/mssql/tables/llx_facture.key.sql index 866fd011aab..bc69f3e4f53 100644 --- a/mssql/tables/llx_facture.key.sql +++ b/mssql/tables/llx_facture.key.sql @@ -28,7 +28,7 @@ CREATE INDEX idx_facture_fk_user_valid ON llx_facture(fk_user_valid); CREATE INDEX idx_facture_fk_facture_source ON llx_facture(fk_facture_source); CREATE INDEX idx_facture_fk_projet ON llx_facture(fk_projet); -ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_facture_source FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid); diff --git a/mssql/tables/llx_facture.sql b/mssql/tables/llx_facture.sql index f684582767d..5cfefb90955 100644 --- a/mssql/tables/llx_facture.sql +++ b/mssql/tables/llx_facture.sql @@ -22,15 +22,15 @@ create table llx_facture ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, facnumber varchar(30) NOT NULL, type smallint DEFAULT 0 NOT NULL, ref_client varchar(30), increment varchar(10), - fk_soc int NOT NULL, - datec datetime, -- date de creation de la facture - datef datetime, -- date de la facture - date_valid datetime, -- date de validation + fk_soc integer NOT NULL, + datec datetime, -- SMALLDATETIME de creation de la facture + datef datetime, -- SMALLDATETIME de la facture + date_valid datetime, -- SMALLDATETIME de validation paye smallint DEFAULT 0 NOT NULL, amount real DEFAULT 0 NOT NULL, remise_percent real DEFAULT 0, -- remise relative @@ -46,15 +46,15 @@ create table llx_facture fk_statut smallint DEFAULT 0 NOT NULL, - fk_user_author int, -- createur de la facture - fk_user_valid int, -- valideur de la facture + fk_user_author integer, -- createur de la facture + fk_user_valid integer, -- valideur de la facture - fk_facture_source int, -- facture origine si facture avoir - fk_projet int, -- projet auquel est associée la facture + fk_facture_source integer, -- facture origine si facture avoir + fk_projet integer, -- projet auquel est associée la facture - fk_cond_reglement int DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) - fk_mode_reglement int, -- mode de reglement (Virement, Prélèvement) - date_lim_reglement datetime, -- date limite de reglement + fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) + fk_mode_reglement integer, -- mode de reglement (Virement, Prélèvement) + date_lim_reglement datetime, -- SMALLDATETIME limite de reglement note text, note_public text, diff --git a/mssql/tables/llx_facture_fourn.key.sql b/mssql/tables/llx_facture_fourn.key.sql index cbcb93d107f..0d5e3709483 100644 --- a/mssql/tables/llx_facture_fourn.key.sql +++ b/mssql/tables/llx_facture_fourn.key.sql @@ -30,7 +30,7 @@ CREATE INDEX idx_facture_fourn_fk_user_author ON llx_facture_fourn(fk_user_autho CREATE INDEX idx_facture_fourn_fk_user_valid ON llx_facture_fourn(fk_user_valid); CREATE INDEX idx_facture_fourn_fk_projet ON llx_facture_fourn(fk_projet); -ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); diff --git a/mssql/tables/llx_facture_fourn.sql b/mssql/tables/llx_facture_fourn.sql index 8c24872c71e..184f45be40c 100644 --- a/mssql/tables/llx_facture_fourn.sql +++ b/mssql/tables/llx_facture_fourn.sql @@ -22,12 +22,12 @@ create table llx_facture_fourn ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, facnumber varchar(50) NOT NULL, type smallint DEFAULT 0 NOT NULL, - fk_soc int NOT NULL, - datec datetime, -- date de creation de la facture - datef datetime, -- date de la facture + fk_soc integer NOT NULL, + datec datetime, -- SMALLDATETIME de creation de la facture + datef datetime, -- SMALLDATETIME de la facture libelle varchar(255), paye smallint DEFAULT 0 NOT NULL, amount real DEFAULT 0 NOT NULL, @@ -40,13 +40,13 @@ create table llx_facture_fourn fk_statut smallint DEFAULT 0 NOT NULL, - fk_user_author int, -- createur de la facture - fk_user_valid int, -- valideur de la facture + fk_user_author integer, -- createur de la facture + fk_user_valid integer, -- valideur de la facture - fk_projet int, -- projet auquel est associée la facture + fk_projet integer, -- projet auquel est associée la facture - fk_cond_reglement int DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) - date_lim_reglement datetime, -- date limite de reglement + fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) + date_lim_reglement datetime, -- SMALLDATETIME limite de reglement note text, note_public text diff --git a/mssql/tables/llx_facture_fourn_det.sql b/mssql/tables/llx_facture_fourn_det.sql index 80e0811c769..0e2f324c464 100644 --- a/mssql/tables/llx_facture_fourn_det.sql +++ b/mssql/tables/llx_facture_fourn_det.sql @@ -21,9 +21,9 @@ create table llx_facture_fourn_det ( - rowid int IDENTITY PRIMARY KEY, - fk_facture_fourn int NOT NULL, - fk_product int NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_facture_fourn integer NOT NULL, + fk_product integer NULL, description text, pu_ht real DEFAULT 0, qty smallint DEFAULT 1, diff --git a/mssql/tables/llx_facture_rec.sql b/mssql/tables/llx_facture_rec.sql index e85084c7037..1a67211b580 100644 --- a/mssql/tables/llx_facture_rec.sql +++ b/mssql/tables/llx_facture_rec.sql @@ -22,10 +22,10 @@ create table llx_facture_rec ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, titre varchar(50) NOT NULL, - fk_soc int NOT NULL, - datec datetime, -- date de creation + fk_soc integer NOT NULL, + datec datetime, -- SMALLDATETIME de creation amount real DEFAULT 0 NOT NULL, remise real DEFAULT 0, @@ -35,11 +35,11 @@ create table llx_facture_rec total real DEFAULT 0, total_ttc real DEFAULT 0, - fk_user_author int, -- createur - fk_projet int, -- projet auquel est associé la facture - fk_cond_reglement int DEFAULT 0, -- condition de reglement - fk_mode_reglement int DEFAULT 0, -- mode de reglement (Virement, Prélèvement) - date_lim_reglement datetime, -- date limite de reglement + fk_user_author integer, -- createur + fk_projet integer, -- projet auquel est associé la facture + fk_cond_reglement integer DEFAULT 0, -- condition de reglement + fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prélèvement) + date_lim_reglement datetime, -- SMALLDATETIME limite de reglement note text, note_public text, diff --git a/mssql/tables/llx_facture_tva_sum.sql b/mssql/tables/llx_facture_tva_sum.sql index e1eec86a60d..87bc796c51c 100644 --- a/mssql/tables/llx_facture_tva_sum.sql +++ b/mssql/tables/llx_facture_tva_sum.sql @@ -21,7 +21,7 @@ create table llx_facture_tva_sum ( - fk_facture int NOT NULL, + fk_facture integer NOT NULL, amount real NOT NULL, tva_tx real NOT NULL ); diff --git a/mssql/tables/llx_facturedet.sql b/mssql/tables/llx_facturedet.sql index 2788e819a8b..e8e0e825e2a 100644 --- a/mssql/tables/llx_facturedet.sql +++ b/mssql/tables/llx_facturedet.sql @@ -3,16 +3,16 @@ -- Copyright (C) 2004-2005 Laurent Destailleur -- -- 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 +-- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 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. +-- GNU General Public License for more details. -- --- You should have received a copy of the GNU General [public] License +-- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- @@ -22,24 +22,25 @@ create table llx_facturedet ( - rowid int IDENTITY PRIMARY KEY, - fk_facture int NOT NULL, - fk_product int NULL, -- Doit pouvoir etre nul pour ligne detail sans produits + rowid integer IDENTITY PRIMARY KEY, + fk_facture integer NOT NULL, + fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits description text, tva_taux real, -- Taux tva produit/service (exemple 19.6) qty real, -- Quantité (exemple 2) remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%) remise real DEFAULT 0, -- Montant calculé de la remise % sur PU HT (exemple 20) - fk_remise_except int NULL, -- Lien vers table des remises fixes + fk_remise_except integer NULL, -- Lien vers table des remises fixes subprice real, -- P.U. HT (exemple 100) price real, -- P.U. HT apres remise % de ligne total_ht real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale total_tva real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale total_ttc real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale - date_start datetime, -- date debut si service - date_end datetime, -- date fin si service - info_bits int DEFAULT 0, -- TVA NPR ou non - fk_code_ventilation int DEFAULT 0 NOT NULL, - fk_export_compta int DEFAULT 0 NOT NULL, - rang int DEFAULT 0 + date_start datetime, -- SMALLDATETIME debut si service + date_end datetime, -- SMALLDATETIME fin si service + info_bits integer DEFAULT 0, -- TVA NPR ou non + fk_code_ventilation integer DEFAULT 0 NOT NULL, + fk_export_compta integer DEFAULT 0 NOT NULL, + rang integer DEFAULT 0, -- ordre d'affichage + special_code tinyint DEFAULT 0 -- code pour les lignes speciales (livraison=1, ecotaxe=2) ); diff --git a/mssql/tables/llx_facturedet_rec.sql b/mssql/tables/llx_facturedet_rec.sql index f026553b557..92e97de9a42 100644 --- a/mssql/tables/llx_facturedet_rec.sql +++ b/mssql/tables/llx_facturedet_rec.sql @@ -21,9 +21,9 @@ create table llx_facturedet_rec ( - rowid int IDENTITY PRIMARY KEY, - fk_facture int NOT NULL, - fk_product int, + rowid integer IDENTITY PRIMARY KEY, + fk_facture integer NOT NULL, + fk_product integer, description text, tva_taux real DEFAULT 19.6, -- taux tva qty real, -- quantité diff --git a/mssql/tables/llx_fichinter.key.sql b/mssql/tables/llx_fichinter.key.sql index 68aaa35d323..e3c509a4d07 100644 --- a/mssql/tables/llx_fichinter.key.sql +++ b/mssql/tables/llx_fichinter.key.sql @@ -22,4 +22,4 @@ CREATE INDEX idx_fichinter_fk_soc ON llx_fichinter(fk_soc); -ALTER TABLE llx_fichinter ADD CONSTRAINT fk_fichinter_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_fichinter ADD CONSTRAINT fk_fichinter_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); diff --git a/mssql/tables/llx_fichinter.sql b/mssql/tables/llx_fichinter.sql index c9e7181ba46..10a56a5d9e0 100644 --- a/mssql/tables/llx_fichinter.sql +++ b/mssql/tables/llx_fichinter.sql @@ -1,17 +1,17 @@ -- =================================================================== --- Copyright (C) 2001-2002 Rodolphe Quiedeville +-- Copyright (C) 2001-2007 Rodolphe Quiedeville -- -- 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 +-- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 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. +-- GNU General Public License for more details. -- --- You should have received a copy of the GNU General [public] License +-- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- @@ -22,18 +22,23 @@ create table llx_fichinter ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int NOT NULL, - fk_projet int DEFAULT 0, -- projet auquel est rattache la fiche + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer NOT NULL, + fk_projet integer DEFAULT 0, -- projet auquel est rattache la fiche + fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche ref varchar(30) NOT NULL, -- number - datec datetime, -- date de creation - date_valid datetime, -- date de validation - datei datetime, -- date de l'intervention - fk_user_author int, -- createur de la fiche - fk_user_valid int, -- valideur de la fiche + tms timestamp, + datec datetime, -- SMALLDATETIME de creation + date_valid datetime, -- SMALLDATETIME de validation + datei SMALLDATETIME, -- SMALLDATETIME de livraison du bon d'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, + duree real, -- durée totale de l'intervention + description text, + note_private text, + note_public text, + model_pdf varchar(50), ); CREATE UNIQUE INDEX ref ON llx_fichinter(ref) diff --git a/mssql/tables/llx_fichinterdet.sql b/mssql/tables/llx_fichinterdet.sql new file mode 100644 index 00000000000..c40f81c4b5d --- /dev/null +++ b/mssql/tables/llx_fichinterdet.sql @@ -0,0 +1,31 @@ +-- =================================================================== +-- Copyright (C) 2002-2003 Rodolphe Quiedeville +-- Copyright (C) 2005-2007 Regis Houssin +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- =================================================================== + +create table llx_fichinterdet +( + rowid integer IDENTITY PRIMARY KEY, + fk_fichinter integer, + SMALLDATETIME SMALLDATETIME, -- SMALLDATETIME de la ligne d'intervention + description text, -- description de la ligne d'intervention + duree integer, -- duree de la ligne d'intervention + rang integer DEFAULT 0 -- ordre affichage sur la fiche +); diff --git a/mssql/tables/llx_fournisseur_ca.sql b/mssql/tables/llx_fournisseur_ca.sql index ed50d492e43..aceb59946ff 100644 --- a/mssql/tables/llx_fournisseur_ca.sql +++ b/mssql/tables/llx_fournisseur_ca.sql @@ -22,7 +22,7 @@ create table llx_fournisseur_ca ( - fk_societe int, + fk_societe integer, date_calcul datetime, year smallint, ca_genere float, -- ca genere par les ventes des produits de ce fournisseur diff --git a/mssql/tables/llx_fournisseur_categorie.sql b/mssql/tables/llx_fournisseur_categorie.sql index d7a1f59144c..d618a77a9f3 100644 --- a/mssql/tables/llx_fournisseur_categorie.sql +++ b/mssql/tables/llx_fournisseur_categorie.sql @@ -22,7 +22,7 @@ create table llx_fournisseur_categorie ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, label varchar(255) ); diff --git a/mssql/tables/llx_groupesociete.sql b/mssql/tables/llx_groupesociete.sql index b56df790d85..d0853724ff5 100644 --- a/mssql/tables/llx_groupesociete.sql +++ b/mssql/tables/llx_groupesociete.sql @@ -22,14 +22,14 @@ create table llx_groupesociete ( - rowid int IDENTITY PRIMARY KEY, - parent int UNIQUE, + rowid integer IDENTITY PRIMARY KEY, + parent integer UNIQUE, tms timestamp, - datec datetime, -- creation date + datec datetime, -- creation SMALLDATETIME nom varchar(60), -- company name note text, -- remise real DEFAULT 0, -- remise systématique pour le client - fk_user_author int + fk_user_author integer ); diff --git a/mssql/tables/llx_groupesociete_remise.sql b/mssql/tables/llx_groupesociete_remise.sql index ec0034b79dc..859256e3848 100644 --- a/mssql/tables/llx_groupesociete_remise.sql +++ b/mssql/tables/llx_groupesociete_remise.sql @@ -24,11 +24,11 @@ create table llx_groupesociete_remise ( - rowid int IDENTITY PRIMARY KEY, - fk_groupe int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_groupe integer NOT NULL, tms timestamp, - datec datetime, -- creation date - fk_user_author int, -- utilisateur qui a créé l'info + datec datetime, -- creation SMALLDATETIME + fk_user_author integer, -- utilisateur qui a créé l'info remise real DEFAULT 0, -- remise systématique pour le client note text diff --git a/mssql/tables/llx_livraison.sql b/mssql/tables/llx_livraison.sql index 1a2f23bb463..1de22e2204a 100644 --- a/mssql/tables/llx_livraison.sql +++ b/mssql/tables/llx_livraison.sql @@ -22,15 +22,15 @@ create table llx_livraison ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - fk_commande int DEFAULT 0, -- commande auquel est rattache le bon de livraison - fk_expedition int, -- expedition auquel est rattache le bon de livraison + fk_commande integer DEFAULT 0, -- commande auquel est rattache le bon de livraison + fk_expedition integer, -- expedition auquel est rattache le bon de livraison ref varchar(30) NOT NULL, -- delivery number - date_creation datetime, -- date de creation - date_valid datetime, -- date de validation - fk_user_author int, -- createur du bon de livraison - fk_user_valid int, -- valideur du bon de livraison + date_creation datetime, -- SMALLDATETIME de creation + date_valid datetime, -- SMALLDATETIME de validation + fk_user_author integer, -- createur du bon de livraison + fk_user_valid integer, -- valideur du bon de livraison fk_statut smallint default 0, total_ht real default 0, total_ttc real default 0, @@ -38,7 +38,7 @@ create table llx_livraison note_public text, model_pdf varchar(50), date_livraison datetime default NULL, - fk_adresse_livraison int -- adresse de livraison + fk_adresse_livraison integer -- adresse de livraison --key(fk_commande) ); diff --git a/mssql/tables/llx_livraisondet.sql b/mssql/tables/llx_livraisondet.sql index ab6db9f47c3..4116068944e 100644 --- a/mssql/tables/llx_livraisondet.sql +++ b/mssql/tables/llx_livraisondet.sql @@ -21,9 +21,9 @@ create table llx_livraisondet ( - rowid int IDENTITY PRIMARY KEY, - fk_livraison int, - fk_commande_ligne int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_livraison integer, + fk_commande_ligne integer NOT NULL, qty real -- quantité --key(fk_livraison), --key(fk_commande_ligne) diff --git a/mssql/tables/llx_mailing.sql b/mssql/tables/llx_mailing.sql index 0759a858f31..db90ec3fcba 100644 --- a/mssql/tables/llx_mailing.sql +++ b/mssql/tables/llx_mailing.sql @@ -27,7 +27,7 @@ create table llx_mailing ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, statut smallint DEFAULT 0, -- @@ -36,20 +36,20 @@ create table llx_mailing body text, cible varchar(60), - nbemail int, + nbemail integer, email_from varchar(160), -- company name email_replyto varchar(160), -- company name email_errorsto varchar(160), -- company name - date_creat datetime, -- creation date + date_creat datetime, -- creation SMALLDATETIME date_valid datetime, -- date_appro datetime, -- - date_envoi datetime, -- date d'envoi + date_envoi datetime, -- SMALLDATETIME d'envoi - fk_user_creat int, -- utilisateur qui a créé l'info - fk_user_valid int, -- utilisateur qui a créé l'info - fk_user_appro int -- utilisateur qui a créé l'info + 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 ); diff --git a/mssql/tables/llx_mailing_cibles.sql b/mssql/tables/llx_mailing_cibles.sql index 4db546c7835..12b666c9149 100644 --- a/mssql/tables/llx_mailing_cibles.sql +++ b/mssql/tables/llx_mailing_cibles.sql @@ -24,9 +24,9 @@ create table llx_mailing_cibles ( - rowid int IDENTITY PRIMARY KEY, - fk_mailing int NOT NULL, - fk_contact int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_mailing integer NOT NULL, + fk_contact integer NOT NULL, nom varchar(160), prenom varchar(160), email varchar(160) NOT NULL, diff --git a/mssql/tables/llx_newsletter.sql b/mssql/tables/llx_newsletter.sql index 067fa278405..cec3ee397ff 100644 --- a/mssql/tables/llx_newsletter.sql +++ b/mssql/tables/llx_newsletter.sql @@ -22,7 +22,7 @@ create table llx_newsletter ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, email_subject varchar(32) NOT NULL, @@ -36,10 +36,10 @@ create table llx_newsletter 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 - nbsent int, -- nombre de mails envoyés - nberror int, -- nombre de mails envoyés - fk_user_author int, - fk_user_valid int, - fk_user_modif int + nbsent integer, -- nombre de mails envoyés + nberror integer, -- nombre de mails envoyés + fk_user_author integer, + fk_user_valid integer, + fk_user_modif integer ); diff --git a/mssql/tables/llx_notify.sql b/mssql/tables/llx_notify.sql index a0e522eefe2..b4384f8f1c0 100644 --- a/mssql/tables/llx_notify.sql +++ b/mssql/tables/llx_notify.sql @@ -22,11 +22,11 @@ create table llx_notify ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - daten datetime, -- date de la notification - fk_action int NOT NULL, - fk_contact int NOT NULL, + daten datetime, -- SMALLDATETIME de la notification + fk_action integer NOT NULL, + fk_contact integer NOT NULL, objet_type varchar(12) check(objet_type in ('ficheinter','facture','propale')), - objet_id int NOT NULL + objet_id integer NOT NULL ); diff --git a/mssql/tables/llx_notify_def.sql b/mssql/tables/llx_notify_def.sql index db8c00f22f0..181dbfa8eb7 100644 --- a/mssql/tables/llx_notify_def.sql +++ b/mssql/tables/llx_notify_def.sql @@ -22,10 +22,10 @@ create table llx_notify_def ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - datec datetime, -- date de creation - fk_action int NOT NULL, - fk_soc int NOT NULL, - fk_contact int NOT NULL + datec datetime, -- SMALLDATETIME de creation + fk_action integer NOT NULL, + fk_soc integer NOT NULL, + fk_contact integer NOT NULL ); diff --git a/mssql/tables/llx_osc_categories.sql b/mssql/tables/llx_osc_categories.sql new file mode 100644 index 00000000000..5c2cfc80864 --- /dev/null +++ b/mssql/tables/llx_osc_categories.sql @@ -0,0 +1,30 @@ +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- =================================================================== + +CREATE TABLE llx_osc_categories ( + rowid integer NOT NULL IDENTITY PRIMARY KEY, + dolicatid integer NOT NULL default 0, + osccatid integer NOT NULL default 0 +); + +CREATE UNIQUE INDEX dolicatid ON llx_osc_categories(dolicatid) +CREATE UNIQUE INDEX osccatid ON llx_osc_categories(osccatid) diff --git a/mssql/tables/llx_osc_customer.key.sql b/mssql/tables/llx_osc_customer.key.sql index ac61177b200..0d8482df139 100644 --- a/mssql/tables/llx_osc_customer.key.sql +++ b/mssql/tables/llx_osc_customer.key.sql @@ -9,5 +9,4 @@ -- -ALTER TABLE llx_osc_customer - ADD CONSTRAINT llx_osc_customer_societe_idp FOREIGN KEY (doli_socidp) REFERENCES llx_societe (idp); +ALTER TABLE llx_osc_customer ADD CONSTRAINT fk_osc_customer_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); diff --git a/mssql/tables/llx_osc_customer.sql b/mssql/tables/llx_osc_customer.sql index 1b18ae63468..c2ed0592be3 100644 --- a/mssql/tables/llx_osc_customer.sql +++ b/mssql/tables/llx_osc_customer.sql @@ -1,17 +1,29 @@ --- phpMyAdmin SQL Dump --- version 2.6.2-Debian-3sarge1 --- http://www.phpmyadmin.net --- --- Serveur: localhost --- Généré le : Samedi 05 Août 2006 à 17:25 --- Version du serveur: 4.0.24 --- Version de PHP: 4.3.10-16 --- +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- =================================================================== -if not exists (select * from sysobjects where name='llx_osc_customer' and xtype='U') -CREATE TABLE llx_osc_customer -( - osc_custid int PRIMARY KEY NOT NULL default 0, - osc_lastmodif datetime default NULL, - doli_socidp int UNIQUE NOT NULL default 0, +CREATE TABLE llx_osc_customer ( + rowid integer NOT NULL PRIMARY KEY default '0', + datem datetime default NULL, + fk_soc integer NOT NULL default '0', ); + +CREATE UNIQUE INDEX fk_soc ON llx_osc_customer(fk_soc) diff --git a/mssql/tables/llx_osc_order.sql b/mssql/tables/llx_osc_order.sql index 5dff728b631..e029e02cf45 100644 --- a/mssql/tables/llx_osc_order.sql +++ b/mssql/tables/llx_osc_order.sql @@ -1,24 +1,29 @@ --- phpMyAdmin SQL Dump --- version 2.6.2-Debian-3sarge1 --- http://www.phpmyadmin.net --- --- Serveur: localhost --- Généré le : Samedi 05 Août 2006 à 17:25 --- Version du serveur: 4.0.24 --- Version de PHP: 4.3.10-16 --- --- Base de données: 'dolidev' --- +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- =================================================================== --- -------------------------------------------------------- - --- --- Structure de la table 'llx_osc_order' --- - -if not exists (select * from sysobjects where name='llx_osc_order' and xtype='U') CREATE TABLE llx_osc_order ( - osc_orderid int PRIMARY KEY NOT NULL default 0, - osc_lastmodif datetime default NULL, - doli_orderidp int UNIQUE NOT NULL default 0, + rowid integer PRIMARY KEY NOT NULL default '0', + datem datetime default NULL, + fk_commande integer NOT NULL default '0', ); + +CREATE UNIQUE INDEX fk_commande ON llx_osc_order(fk_commande) diff --git a/mssql/tables/llx_osc_product.sql b/mssql/tables/llx_osc_product.sql index 38fb16e1626..3749cb97e3c 100644 --- a/mssql/tables/llx_osc_product.sql +++ b/mssql/tables/llx_osc_product.sql @@ -1,24 +1,29 @@ --- phpMyAdmin SQL Dump --- version 2.6.2-Debian-3sarge1 --- http://www.phpmyadmin.net --- --- Serveur: localhost --- Généré le : Samedi 05 Août 2006 à 17:25 --- Version du serveur: 4.0.24 --- Version de PHP: 4.3.10-16 --- --- Base de données: 'dolidev' --- +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- =================================================================== --- -------------------------------------------------------- - --- --- Structure de la table 'llx_osc_product' --- - -if not exists (select * from sysobjects where name='llx_osc_product' and xtype='U') CREATE TABLE llx_osc_product ( - osc_prodid int PRIMARY KEY NOT NULL default 0, - osc_lastmodif datetime default NULL, - doli_prodidp int UNIQUE NOT NULL default 0, + rowid integer IDENTITY(0, 1) PRIMARY KEY, + datem datetime default NULL, + fk_product integer NOT NULL default '0' ); + +CREATE UNIQUE INDEX fk_product ON llx_osc_product(fk_product) diff --git a/mssql/tables/llx_paiement.sql b/mssql/tables/llx_paiement.sql index 1b099849fe4..b000882374d 100644 --- a/mssql/tables/llx_paiement.sql +++ b/mssql/tables/llx_paiement.sql @@ -26,20 +26,20 @@ create table llx_paiement ( - rowid int IDENTITY PRIMARY KEY, - fk_facture int, - datec datetime, -- date de creation + rowid integer IDENTITY PRIMARY KEY, + fk_facture integer, + datec datetime, -- SMALLDATETIME de creation tms timestamp, - datep datetime, -- payment date + datep datetime, -- payment SMALLDATETIME amount real DEFAULT 0, author varchar(50), - fk_paiement int NOT NULL, + fk_paiement integer NOT NULL, num_paiement varchar(50), note text, - fk_bank int NOT NULL, - fk_user_creat int, -- utilisateur qui a créé l'info - fk_user_modif int, -- utilisateur qui a modifié l'info + fk_bank integer NOT NULL, + fk_user_creat integer, -- utilisateur qui a créé l'info + fk_user_modif integer, -- utilisateur qui a modifié l'info statut smallint DEFAULT 0 NOT NULL, - fk_export_compta int DEFAULT 0 NOT NULL + fk_export_compta integer DEFAULT 0 NOT NULL ); diff --git a/mssql/tables/llx_paiement_facture.sql b/mssql/tables/llx_paiement_facture.sql index 23a7e928d84..2bfe38858d2 100644 --- a/mssql/tables/llx_paiement_facture.sql +++ b/mssql/tables/llx_paiement_facture.sql @@ -21,8 +21,8 @@ create table llx_paiement_facture ( - rowid int IDENTITY PRIMARY KEY, - fk_paiement int, - fk_facture int, + rowid integer IDENTITY PRIMARY KEY, + fk_paiement integer, + fk_facture integer, amount real DEFAULT 0 ); diff --git a/mssql/tables/llx_paiementcharge.sql b/mssql/tables/llx_paiementcharge.sql index 20a80d30890..a81cdd0b087 100644 --- a/mssql/tables/llx_paiementcharge.sql +++ b/mssql/tables/llx_paiementcharge.sql @@ -21,17 +21,17 @@ create table llx_paiementcharge ( - rowid int IDENTITY PRIMARY KEY, - fk_charge int, - datec datetime, -- date de creation + rowid integer IDENTITY PRIMARY KEY, + fk_charge integer, + datec datetime, -- SMALLDATETIME de creation tms timestamp, - datep datetime, -- payment date + datep datetime, -- payment SMALLDATETIME amount real DEFAULT 0, - fk_typepaiement int NOT NULL, + fk_typepaiement integer NOT NULL, num_paiement varchar(50), note text, - fk_bank int NOT NULL, - fk_user_creat int, -- utilisateur qui a créé l'info - fk_user_modif int -- utilisateur qui a modifié l'info + fk_bank integer NOT NULL, + fk_user_creat integer, -- utilisateur qui a créé l'info + fk_user_modif integer -- utilisateur qui a modifié l'info ); diff --git a/mssql/tables/llx_paiementfourn.sql b/mssql/tables/llx_paiementfourn.sql index 927866f7968..63b5d0512cb 100644 --- a/mssql/tables/llx_paiementfourn.sql +++ b/mssql/tables/llx_paiementfourn.sql @@ -22,16 +22,16 @@ create table llx_paiementfourn ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - datec datetime, -- date de creation de l'enregistrement - fk_facture_fourn int, -- facture - datep datetime, -- date de paiement + datec datetime, -- SMALLDATETIME de creation de l'enregistrement + fk_facture_fourn integer, -- facture + datep datetime, -- SMALLDATETIME de paiement amount real DEFAULT 0, -- montant - fk_user_author int, -- auteur - fk_paiement int NOT NULL, -- moyen de paiement + fk_user_author integer, -- auteur + fk_paiement integer NOT NULL, -- moyen de paiement num_paiement varchar(50), -- numéro de paiement (cheque) note text, - fk_bank int NOT NULL, + fk_bank integer NOT NULL, statut smallint NOT NULL DEFAULT 0 ); diff --git a/mssql/tables/llx_paiementfourn_facturefourn.sql b/mssql/tables/llx_paiementfourn_facturefourn.sql index 2dd2f462a58..62d0f1bd135 100644 --- a/mssql/tables/llx_paiementfourn_facturefourn.sql +++ b/mssql/tables/llx_paiementfourn_facturefourn.sql @@ -23,8 +23,8 @@ create table llx_paiementfourn_facturefourn ( - rowid int IDENTITY PRIMARY KEY, - fk_paiementfourn INT DEFAULT NULL, - fk_facturefourn INT DEFAULT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_paiementfourn integer DEFAULT NULL, + fk_facturefourn integer DEFAULT NULL, amount FLOAT(25) DEFAULT '0' ); \ No newline at end of file diff --git a/mssql/tables/llx_prelevement_bons.sql b/mssql/tables/llx_prelevement_bons.sql index e5c30e2b989..6ee30467848 100644 --- a/mssql/tables/llx_prelevement_bons.sql +++ b/mssql/tables/llx_prelevement_bons.sql @@ -26,18 +26,18 @@ -- create table llx_prelevement_bons ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, ref varchar(12), -- reference - datec datetime, -- date de creation + datec datetime, -- SMALLDATETIME 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 datetime, -- SMALLDATETIME de transmission à la banque method_trans smallint, -- méthode de transmission - fk_user_trans int, -- user qui a effectué la transmission - date_credit datetime, -- date de crédit sur le compte - fk_user_credit int, -- user qui a remonté l'info de crédit + fk_user_trans integer, -- user qui a effectué la transmission + date_credit datetime, -- SMALLDATETIME de crédit sur le compte + fk_user_credit integer, -- user qui a remonté l'info de crédit UNIQUE(ref) ); diff --git a/mssql/tables/llx_prelevement_facture.sql b/mssql/tables/llx_prelevement_facture.sql index 7fe017ebafe..c159c3a00f1 100644 --- a/mssql/tables/llx_prelevement_facture.sql +++ b/mssql/tables/llx_prelevement_facture.sql @@ -23,8 +23,8 @@ create table llx_prelevement_facture ( - rowid int IDENTITY PRIMARY KEY, - fk_facture int NOT NULL, - fk_prelevement_lignes int NOT NULL + rowid integer IDENTITY PRIMARY KEY, + fk_facture integer NOT NULL, + fk_prelevement_lignes integer NOT NULL ); diff --git a/mssql/tables/llx_prelevement_facture_demande.sql b/mssql/tables/llx_prelevement_facture_demande.sql index f7043bf810b..6284e2c38dc 100644 --- a/mssql/tables/llx_prelevement_facture_demande.sql +++ b/mssql/tables/llx_prelevement_facture_demande.sql @@ -23,14 +23,14 @@ create table llx_prelevement_facture_demande ( - rowid int IDENTITY PRIMARY KEY, - fk_facture int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_facture integer NOT NULL, amount real NOT NULL, date_demande datetime NOT NULL, traite smallint DEFAULT 0, date_traite datetime, - fk_prelevement_bons int, - fk_user_demande int NOT NULL, + fk_prelevement_bons integer, + fk_user_demande integer NOT NULL, code_banque varchar(7), code_guichet varchar(6), diff --git a/mssql/tables/llx_prelevement_lignes.sql b/mssql/tables/llx_prelevement_lignes.sql index 74a839cc3da..6f8b2b154a1 100644 --- a/mssql/tables/llx_prelevement_lignes.sql +++ b/mssql/tables/llx_prelevement_lignes.sql @@ -23,9 +23,9 @@ create table llx_prelevement_lignes ( - rowid int IDENTITY PRIMARY KEY, - fk_prelevement_bons int, - fk_soc int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_prelevement_bons integer, + fk_soc integer NOT NULL, statut smallint DEFAULT 0, client_nom varchar(255), diff --git a/mssql/tables/llx_prelevement_notifications.sql b/mssql/tables/llx_prelevement_notifications.sql index 21b2aa28c8a..a4ffcaed8ca 100644 --- a/mssql/tables/llx_prelevement_notifications.sql +++ b/mssql/tables/llx_prelevement_notifications.sql @@ -28,8 +28,8 @@ create table llx_prelevement_notifications ( - rowid int IDENTITY PRIMARY KEY, - fk_user int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_user integer NOT NULL, action varchar(2) ); diff --git a/mssql/tables/llx_prelevement_rejet.sql b/mssql/tables/llx_prelevement_rejet.sql index 54d727ac155..6c353f302b1 100644 --- a/mssql/tables/llx_prelevement_rejet.sql +++ b/mssql/tables/llx_prelevement_rejet.sql @@ -23,13 +23,13 @@ create table llx_prelevement_rejet ( - rowid int IDENTITY PRIMARY KEY, - fk_prelevement_lignes int, + rowid integer IDENTITY PRIMARY KEY, + fk_prelevement_lignes integer, date_rejet datetime, - motif int, + motif integer, date_creation datetime, - fk_user_creation int, + fk_user_creation integer, note text, afacturer tinyint default 0, - fk_facture int + fk_facture integer ); diff --git a/mssql/tables/llx_product.sql b/mssql/tables/llx_product.sql index acc8f64b12c..9f070e17c6b 100644 --- a/mssql/tables/llx_product.sql +++ b/mssql/tables/llx_product.sql @@ -22,7 +22,7 @@ create table llx_product ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, ref varchar(16) NOT NULL, @@ -33,14 +33,14 @@ create table llx_product price_ttc float(12) DEFAULT 0, price_base_type varchar(3) DEFAULT 'HT', tva_tx FLOAT(25), - fk_user_author int, + fk_user_author integer, envente tinyint DEFAULT 1, - nbvente int DEFAULT 0, - fk_product_type int DEFAULT 0, + nbvente integer DEFAULT 0, + fk_product_type integer DEFAULT 0, duration varchar(6), - stock_propale int DEFAULT 0, - stock_commande int DEFAULT 0, - seuil_stock_alerte int DEFAULT 0, + stock_propale integer DEFAULT 0, + stock_commande integer DEFAULT 0, + seuil_stock_alerte integer DEFAULT 0, stock_loc varchar(10), -- emplacement dans le stock gencode varchar(255) DEFAULT NULL, weight float DEFAULT NULL, diff --git a/mssql/tables/llx_product_ca.sql b/mssql/tables/llx_product_ca.sql index f85c9b117fb..d87266b4e71 100644 --- a/mssql/tables/llx_product_ca.sql +++ b/mssql/tables/llx_product_ca.sql @@ -22,7 +22,7 @@ create table llx_product_ca ( - fk_product int, + fk_product integer, date_calcul datetime, year smallint, ca_genere float, diff --git a/mssql/tables/llx_product_cnv_livre.sql b/mssql/tables/llx_product_cnv_livre.sql index 56b7cc29ac7..2e82508f819 100644 --- a/mssql/tables/llx_product_cnv_livre.sql +++ b/mssql/tables/llx_product_cnv_livre.sql @@ -24,7 +24,7 @@ -- create table llx_product_cnv_livre ( - rowid int PRIMARY KEY, + rowid integer PRIMARY KEY, isbn varchar(13), -- code ISBN ean varchar(13), -- code EAN format varchar(7), -- format de l'ouvrage @@ -37,9 +37,9 @@ create table llx_product_cnv_livre pages smallint, -- nombre de page - fk_couverture int, - fk_contrat int, - fk_auteur int DEFAULT 0 -- auteur lien vers llx_societe + fk_couverture integer, + fk_contrat integer, + fk_auteur integer DEFAULT 0 -- auteur lien vers llx_societe ); diff --git a/mssql/tables/llx_product_cnv_livre_contrat.sql b/mssql/tables/llx_product_cnv_livre_contrat.sql index 35b0baa5cb6..f4f23b6c4c8 100644 --- a/mssql/tables/llx_product_cnv_livre_contrat.sql +++ b/mssql/tables/llx_product_cnv_livre_contrat.sql @@ -22,13 +22,13 @@ create table llx_product_cnv_livre_contrat ( - rowid int IDENTITY PRIMARY KEY, - fk_cnv_livre int, + rowid integer IDENTITY PRIMARY KEY, + fk_cnv_livre integer, - quantite int, -- quantite achete + quantite integer, -- quantite achete taux float(3), -- taux contractuel - date_app datetime, -- date d'application + date_app datetime, -- SMALLDATETIME d'application duree varchar(50) -- duree du contrat ); diff --git a/mssql/tables/llx_product_det.sql b/mssql/tables/llx_product_det.sql index 0783a13b103..d78dabe570b 100644 --- a/mssql/tables/llx_product_det.sql +++ b/mssql/tables/llx_product_det.sql @@ -22,8 +22,8 @@ create table llx_product_det ( - rowid int IDENTITY PRIMARY KEY, - fk_product int DEFAULT 0 NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_product integer DEFAULT 0 NOT NULL, lang varchar(5) DEFAULT 0 NOT NULL, label varchar(255) NOT NULL, description text, diff --git a/mssql/tables/llx_product_fournisseur.sql b/mssql/tables/llx_product_fournisseur.sql index dc6e8c1afd5..a98be758d62 100644 --- a/mssql/tables/llx_product_fournisseur.sql +++ b/mssql/tables/llx_product_fournisseur.sql @@ -22,13 +22,13 @@ create table llx_product_fournisseur ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, - fk_product int, - fk_soc int, + fk_product integer, + fk_soc integer, ref_fourn varchar(30), - fk_user_author int + fk_user_author integer --key(fk_product), --key(fk_soc) diff --git a/mssql/tables/llx_product_fournisseur_price.key.sql b/mssql/tables/llx_product_fournisseur_price.key.sql index 699f50f9cbd..a583abf57d1 100644 --- a/mssql/tables/llx_product_fournisseur_price.key.sql +++ b/mssql/tables/llx_product_fournisseur_price.key.sql @@ -27,7 +27,7 @@ CREATE INDEX idx_product_fournisseur_price_fk_soc ON llx_product_fournisseur_pri CREATE INDEX idx_product_fournisseur_price_fk_product ON llx_product_fournisseur_price(fk_product); ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); -ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); diff --git a/mssql/tables/llx_product_fournisseur_price.sql b/mssql/tables/llx_product_fournisseur_price.sql index e512ac08fb2..876aa946364 100644 --- a/mssql/tables/llx_product_fournisseur_price.sql +++ b/mssql/tables/llx_product_fournisseur_price.sql @@ -22,13 +22,13 @@ create table llx_product_fournisseur_price ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, - fk_product int, - fk_soc int, -- lien sur llx_societe + fk_product integer, + fk_soc integer, -- lien sur llx_societe price real, quantity real, - fk_user int + fk_user integer ); diff --git a/mssql/tables/llx_product_fournisseur_price_log.sql b/mssql/tables/llx_product_fournisseur_price_log.sql index be2925ce65a..07f5af61dd6 100644 --- a/mssql/tables/llx_product_fournisseur_price_log.sql +++ b/mssql/tables/llx_product_fournisseur_price_log.sql @@ -22,12 +22,12 @@ create table llx_product_fournisseur_price_log ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, - fk_product int, - fk_soc int, -- lien sur llx_societe + fk_product integer, + fk_soc integer, -- lien sur llx_societe price real, quantity real, - fk_user int + fk_user integer ); diff --git a/mssql/tables/llx_product_price.sql b/mssql/tables/llx_product_price.sql index 408f792f9fc..577ed6954a5 100644 --- a/mssql/tables/llx_product_price.sql +++ b/mssql/tables/llx_product_price.sql @@ -22,16 +22,16 @@ create table llx_product_price ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - fk_product int NOT NULL, + fk_product integer NOT NULL, date_price datetime NOT NULL, price_level tinyint NULL DEFAULT 1, price FLOAT(25), price_ttc float(12) DEFAULT 0, price_base_type varchar(3) DEFAULT 'HT', tva_tx FLOAT(25) NOT NULL, - fk_user_author int, + fk_user_author integer, envente tinyint DEFAULT 1 ); diff --git a/mssql/tables/llx_product_stock.sql b/mssql/tables/llx_product_stock.sql index 6f65f512432..09a0f29523f 100644 --- a/mssql/tables/llx_product_stock.sql +++ b/mssql/tables/llx_product_stock.sql @@ -22,11 +22,11 @@ create table llx_product_stock ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - fk_product int NOT NULL, - fk_entrepot int NOT NULL, - reel int -- stock réel + fk_product integer NOT NULL, + fk_entrepot integer NOT NULL, + reel integer -- stock réel --key(fk_product), --key(fk_entrepot) diff --git a/mssql/tables/llx_product_subproduct.sql b/mssql/tables/llx_product_subproduct.sql index 9afd466e912..47b3f990c27 100644 --- a/mssql/tables/llx_product_subproduct.sql +++ b/mssql/tables/llx_product_subproduct.sql @@ -22,9 +22,9 @@ create table llx_product_subproduct ( - rowid int IDENTITY PRIMARY KEY, - fk_product int NOT NULL, -- id du produit maitre - fk_product_subproduct int NOT NULL, -- id du sous-produit + rowid integer IDENTITY PRIMARY KEY, + fk_product integer NOT NULL, -- id du produit maitre + fk_product_subproduct integer NOT NULL, -- id du sous-produit UNIQUE(fk_product, fk_product_subproduct) ); diff --git a/mssql/tables/llx_projet.sql b/mssql/tables/llx_projet.sql index c096e018d46..37ccd0802af 100644 --- a/mssql/tables/llx_projet.sql +++ b/mssql/tables/llx_projet.sql @@ -22,15 +22,15 @@ create table llx_projet ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer NOT NULL, fk_statut smallint NOT NULL, tms timestamp, - dateo datetime, -- date d'ouverture du projet + dateo datetime, -- SMALLDATETIME d'ouverture du projet ref varchar(50), title varchar(255), - fk_user_resp int, -- responsable du projet - fk_user_creat int, -- createur du projet + fk_user_resp integer, -- responsable du projet + fk_user_creat integer, -- createur du projet note text, ); diff --git a/mssql/tables/llx_projet_task.sql b/mssql/tables/llx_projet_task.sql index cd6286b09e3..93a2f24f85d 100644 --- a/mssql/tables/llx_projet_task.sql +++ b/mssql/tables/llx_projet_task.sql @@ -22,12 +22,12 @@ create table llx_projet_task ( - rowid int IDENTITY PRIMARY KEY, - fk_projet int NOT NULL, - fk_task_parent int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_projet integer NOT NULL, + fk_task_parent integer NOT NULL, title varchar(255), duration_effective real NOT NULL, - fk_user_creat int, -- createur + fk_user_creat integer, -- createur statut varchar(6) check (statut in ('open','closed')) DEFAULT 'open', note text diff --git a/mssql/tables/llx_projet_task_actors.sql b/mssql/tables/llx_projet_task_actors.sql index 5be0ad5a70e..7ca93d90323 100644 --- a/mssql/tables/llx_projet_task_actors.sql +++ b/mssql/tables/llx_projet_task_actors.sql @@ -22,8 +22,8 @@ create table llx_projet_task_actors ( - fk_projet_task int NOT NULL, - fk_user int NOT NULL, + fk_projet_task integer NOT NULL, + fk_user integer NOT NULL, role varchar(5) check (role in ('admin','read','acto','info')) DEFAULT 'admin', --key (role) diff --git a/mssql/tables/llx_projet_task_time.sql b/mssql/tables/llx_projet_task_time.sql index d53ea90fad9..0c5ccaca36f 100644 --- a/mssql/tables/llx_projet_task_time.sql +++ b/mssql/tables/llx_projet_task_time.sql @@ -22,11 +22,11 @@ create table llx_projet_task_time ( - rowid int IDENTITY PRIMARY KEY, - fk_task int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_task integer NOT NULL, task_date datetime, task_duration FLOAT(25), - fk_user int, + fk_user integer, note text --key(fk_task), diff --git a/mssql/tables/llx_propal.key.sql b/mssql/tables/llx_propal.key.sql index fec11525e0e..7af13e50794 100644 --- a/mssql/tables/llx_propal.key.sql +++ b/mssql/tables/llx_propal.key.sql @@ -25,5 +25,5 @@ CREATE INDEX idx_propal_fk_soc ON llx_propal(fk_soc); -ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); diff --git a/mssql/tables/llx_propal.sql b/mssql/tables/llx_propal.sql index d088c74bfe9..6acfe404d16 100644 --- a/mssql/tables/llx_propal.sql +++ b/mssql/tables/llx_propal.sql @@ -22,20 +22,20 @@ create table llx_propal ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int, - fk_projet int DEFAULT 0, -- projet auquel est rattache la propale + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer, + fk_projet integer DEFAULT 0, -- projet auquel est rattache la propale ref varchar(30) NOT NULL, -- propal number ref_client varchar(30), -- customer order number - datec datetime, -- date de creation - datep datetime, -- date de la propal - fin_validite datetime, -- date de fin de validite - date_valid datetime, -- date de validation - date_cloture datetime, -- date de cloture - fk_user_author int, -- createur de la propale - fk_user_valid int, -- valideur de la propale - fk_user_cloture int, -- cloture de la propale signee ou non signee + datec datetime, -- SMALLDATETIME de creation + datep datetime, -- SMALLDATETIME de la propal + fin_validite datetime, -- SMALLDATETIME de fin de validite + date_valid datetime, -- SMALLDATETIME de validation + date_cloture datetime, -- SMALLDATETIME de cloture + fk_user_author integer, -- createur de la propale + fk_user_valid integer, -- valideur de la propale + fk_user_cloture integer, -- cloture de la propale signee ou non signee fk_statut smallint DEFAULT 0 NOT NULL, price real DEFAULT 0, remise_percent real DEFAULT 0, -- remise globale relative en pourcent @@ -45,14 +45,14 @@ create table llx_propal total_ht real DEFAULT 0, -- montant total ht apres remise globale total real DEFAULT 0, -- montant total ttc apres remise globale - fk_cond_reglement int, -- condition de reglement (30 jours, fin de mois ...) - fk_mode_reglement int, -- mode de reglement (Virement, Prélèvement) + fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...) + fk_mode_reglement integer, -- mode de reglement (Virement, Prélèvement) note text, note_public text, model_pdf varchar(50), date_livraison datetime default NULL, - fk_adresse_livraison int, -- adresse de livraison + fk_adresse_livraison integer, -- adresse de livraison ); CREATE UNIQUE INDEX ref ON llx_propal(ref) diff --git a/mssql/tables/llx_propaldet.sql b/mssql/tables/llx_propaldet.sql index 8fdec8e93c1..cfaf613aa9f 100644 --- a/mssql/tables/llx_propaldet.sql +++ b/mssql/tables/llx_propaldet.sql @@ -21,21 +21,21 @@ create table llx_propaldet ( - rowid int IDENTITY PRIMARY KEY, - fk_propal int, - fk_product int, + rowid integer IDENTITY PRIMARY KEY, + fk_propal integer, + fk_product integer, description text, tva_tx real, -- taux tva qty real, -- quantité remise_percent real DEFAULT 0, -- pourcentage de remise remise real DEFAULT 0, -- montant de la remise - fk_remise_except int NULL, -- Lien vers table des remises fixes + fk_remise_except integer NULL, -- Lien vers table des remises fixes subprice real, -- prix avant remise price real, -- prix final total_ht real, -- Total HT de la ligne toute quantité et incluant remise ligne et globale total_tva real, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale total_ttc real, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale - info_bits int DEFAULT 0, -- TVA NPR ou non + info_bits integer DEFAULT 0, -- TVA NPR ou non coef real, -- coefficient de marge - rang int DEFAULT 0 + rang integer DEFAULT 0 ); diff --git a/mssql/tables/llx_rights_def.sql b/mssql/tables/llx_rights_def.sql index 6e0976bfe44..c662c515ed7 100644 --- a/mssql/tables/llx_rights_def.sql +++ b/mssql/tables/llx_rights_def.sql @@ -22,7 +22,7 @@ create table llx_rights_def ( - id int PRIMARY KEY, + id integer PRIMARY KEY, libelle varchar(255), module varchar(12), perms varchar(50), diff --git a/mssql/tables/llx_so_gr.sql b/mssql/tables/llx_so_gr.sql index 5eb3ce74a16..ae75e97076f 100644 --- a/mssql/tables/llx_so_gr.sql +++ b/mssql/tables/llx_so_gr.sql @@ -23,9 +23,9 @@ create table llx_so_gr ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int, - fk_groupe int, + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer, + fk_groupe integer, UNIQUE(fk_soc, fk_groupe) diff --git a/mssql/tables/llx_soc_events.sql b/mssql/tables/llx_soc_events.sql index 51b7ae993b6..a87d295190d 100644 --- a/mssql/tables/llx_soc_events.sql +++ b/mssql/tables/llx_soc_events.sql @@ -22,10 +22,10 @@ create table llx_soc_events ( - rowid int IDENTITY PRIMARY KEY, -- [public] id - fk_soc int NOT NULL, -- - dateb datetime NOT NULL, -- begin date - datee datetime NOT NULL, -- end date + rowid integer IDENTITY PRIMARY KEY, -- [public] id + fk_soc integer NOT NULL, -- + dateb datetime NOT NULL, -- begin SMALLDATETIME + datee datetime NOT NULL, -- end SMALLDATETIME title varchar(100) NOT NULL, url varchar(255), description text diff --git a/mssql/tables/llx_societe.sql b/mssql/tables/llx_societe.sql index 5e6dc4d2b83..98b83f2ba38 100644 --- a/mssql/tables/llx_societe.sql +++ b/mssql/tables/llx_societe.sql @@ -22,12 +22,12 @@ create table llx_societe ( - idp int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, statut tinyint DEFAULT 0, -- statut - parent int, + parent integer, tms timestamp, - datec datetime, -- creation date - datea datetime, -- activation date + datec datetime, -- creation SMALLDATETIME + datea datetime, -- activation SMALLDATETIME nom varchar(60), -- company name code_client varchar(15), -- code client code_fournisseur varchar(15), -- code founisseur @@ -36,16 +36,16 @@ create table llx_societe address varchar(255), -- company adresse cp varchar(10), -- zipcode ville varchar(50), -- town - fk_departement int DEFAULT 0, -- - fk_pays int DEFAULT 0, -- + fk_departement integer DEFAULT 0, -- + fk_pays integer DEFAULT 0, -- tel varchar(20), -- phone number fax varchar(20), -- fax number url varchar(255), -- email varchar(128), -- - fk_secteur int DEFAULT 0, -- - fk_effectif int DEFAULT 0, -- - fk_typent int DEFAULT 0, -- - fk_forme_juridique int DEFAULT 0, -- forme juridique INSEE + fk_secteur integer DEFAULT 0, -- + fk_effectif integer DEFAULT 0, -- + fk_typent integer DEFAULT 0, -- + fk_forme_juridique integer DEFAULT 0, -- forme juridique INSEE siren varchar(16), -- IDProf1: siren ou RCS pour france siret varchar(16), -- IDProf2: siret pour france ape varchar(16), -- IDProf3: code ape pour france @@ -63,8 +63,8 @@ create table llx_societe customer_rate real DEFAULT 0, -- taux fiabilié client (0 à 1) supplier_rate real DEFAULT 0, -- taux fiabilié fournisseur (0 à 1) rubrique varchar(255), -- champ rubrique libre - fk_user_creat int, -- utilisateur qui a créé l'info - fk_user_modif int, -- utilisateur qui a modifié l'info + 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 mode_reglement tinyint, -- mode de réglement cond_reglement tinyint, -- condition de réglement diff --git a/mssql/tables/llx_societe_adresse_livraison.sql b/mssql/tables/llx_societe_adresse_livraison.sql index 9dfb97840e5..fde0cbb5a3b 100644 --- a/mssql/tables/llx_societe_adresse_livraison.sql +++ b/mssql/tables/llx_societe_adresse_livraison.sql @@ -23,17 +23,17 @@ create table llx_societe_adresse_livraison ( - rowid int IDENTITY PRIMARY KEY, - datec datetime, -- creation date - tms timestamp, -- modification date + rowid integer IDENTITY PRIMARY KEY, + datec datetime, -- creation SMALLDATETIME + tms timestamp, -- modification SMALLDATETIME label varchar(30), -- - fk_societe int DEFAULT 0, -- + fk_societe integer DEFAULT 0, -- nom varchar(60), -- company name address varchar(255), -- company adresse cp varchar(10), -- zipcode ville varchar(50), -- town - fk_pays int DEFAULT 0, -- + fk_pays integer DEFAULT 0, -- note text, -- - fk_user_creat int, -- utilisateur qui a créé l'info - fk_user_modif int -- utilisateur qui a modifié l'info + fk_user_creat integer, -- utilisateur qui a créé l'info + fk_user_modif integer -- utilisateur qui a modifié l'info ); \ No newline at end of file diff --git a/mssql/tables/llx_societe_commerciaux.sql b/mssql/tables/llx_societe_commerciaux.sql index 01c3a5f1b7d..dbad3ecb0f9 100644 --- a/mssql/tables/llx_societe_commerciaux.sql +++ b/mssql/tables/llx_societe_commerciaux.sql @@ -22,9 +22,9 @@ create table llx_societe_commerciaux ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int, - fk_user int, + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer, + fk_user integer, ); CREATE UNIQUE INDEX fk_soc_fk_user ON llx_societe_commerciaux(fk_soc, fk_user) diff --git a/mssql/tables/llx_societe_consult.sql b/mssql/tables/llx_societe_consult.sql index a4dc7595186..7d1311c131c 100644 --- a/mssql/tables/llx_societe_consult.sql +++ b/mssql/tables/llx_societe_consult.sql @@ -24,8 +24,8 @@ -- create table llx_societe_consult ( - fk_soc int, - fk_user int, + fk_soc integer, + fk_user integer, datec timestamp, action char check (action in ('w','r')) ); diff --git a/mssql/tables/llx_societe_perms.sql b/mssql/tables/llx_societe_perms.sql index 69bf0bffd03..228ea40030c 100644 --- a/mssql/tables/llx_societe_perms.sql +++ b/mssql/tables/llx_societe_perms.sql @@ -22,8 +22,8 @@ create table llx_societe_perms ( - fk_soc int, - fk_user int, + fk_soc integer, + fk_user integer, pread tinyint DEFAULT 0, -- permission de lecture pwrite tinyint DEFAULT 0, -- permission d'ecriture pperms tinyint DEFAULT 0, -- permission sur les permissions diff --git a/mssql/tables/llx_societe_prices.sql b/mssql/tables/llx_societe_prices.sql index 6315430d123..193110417e8 100644 --- a/mssql/tables/llx_societe_prices.sql +++ b/mssql/tables/llx_societe_prices.sql @@ -22,10 +22,10 @@ create table llx_societe_prices ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int DEFAULT 0, + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer DEFAULT 0, tms timestamp NOT NULL, datec datetime, - fk_user_author int, + fk_user_author integer, price_level tinyint DEFAULT 1 ); diff --git a/mssql/tables/llx_societe_remise.sql b/mssql/tables/llx_societe_remise.sql index ea41b4056b1..4e0d51c4e67 100644 --- a/mssql/tables/llx_societe_remise.sql +++ b/mssql/tables/llx_societe_remise.sql @@ -2,33 +2,32 @@ -- Copyright (C) 2000-2004 Rodolphe Quiedeville -- -- 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 +-- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 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. +-- GNU General Public License for more details. -- --- You should have received a copy of the GNU General [public] License +-- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- $Id$ -- $Source$ -- --- Historique des remises clients --- +-- Historique evolution de la remise relative des tiers -- ======================================================================== create table llx_societe_remise ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer NOT NULL, tms timestamp, - datec datetime, -- creation date - fk_user_author int, -- utilisateur qui a créé l'info + datec datetime, -- creation SMALLDATETIME + fk_user_author integer, -- utilisateur qui a créé l'info remise_client real DEFAULT 0, -- remise systématique pour le client note text diff --git a/mssql/tables/llx_societe_remise_except.key.sql b/mssql/tables/llx_societe_remise_except.key.sql index ada04fa9ec1..8368ee89e52 100644 --- a/mssql/tables/llx_societe_remise_except.key.sql +++ b/mssql/tables/llx_societe_remise_except.key.sql @@ -31,7 +31,7 @@ CREATE INDEX idx_societe_remise_except_fk_facture_source ON llx_societe_remise_e ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); -ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facturedet (rowid); ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture_source FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid); diff --git a/mssql/tables/llx_societe_remise_except.sql b/mssql/tables/llx_societe_remise_except.sql index 912fbe684d6..4e6ae353a58 100644 --- a/mssql/tables/llx_societe_remise_except.sql +++ b/mssql/tables/llx_societe_remise_except.sql @@ -24,15 +24,15 @@ create table llx_societe_remise_except ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int NOT NULL, -- client + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer NOT NULL, -- client datec datetime, amount_ht real NOT NULL, amount_tva real DEFAULT 0 NOT NULL, amount_ttc real DEFAULT 0 NOT NULL, tva_tx real DEFAULT 0 NOT NULL, - fk_user int NOT NULL, - fk_facture int, - fk_facture_source int, + fk_user integer NOT NULL, + fk_facture integer, + fk_facture_source integer, description varchar(255) NOT NULL ); diff --git a/mssql/tables/llx_societe_rib.sql b/mssql/tables/llx_societe_rib.sql index c73376e48ae..7d160bca707 100644 --- a/mssql/tables/llx_societe_rib.sql +++ b/mssql/tables/llx_societe_rib.sql @@ -24,8 +24,8 @@ create table llx_societe_rib ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer NOT NULL, datec datetime, tms timestamp, label varchar(30), diff --git a/mssql/tables/llx_socpeople.key.sql b/mssql/tables/llx_socpeople.key.sql index 668ddf39c31..dd475aa6b44 100644 --- a/mssql/tables/llx_socpeople.key.sql +++ b/mssql/tables/llx_socpeople.key.sql @@ -22,4 +22,4 @@ CREATE INDEX idx_socpeople_fk_soc ON llx_socpeople(fk_soc); -ALTER TABLE llx_socpeople ADD CONSTRAINT fk_socpeople_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_socpeople ADD CONSTRAINT fk_socpeople_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); diff --git a/mssql/tables/llx_socpeople.sql b/mssql/tables/llx_socpeople.sql index 4bcbbc584bf..370ac5acb78 100644 --- a/mssql/tables/llx_socpeople.sql +++ b/mssql/tables/llx_socpeople.sql @@ -22,17 +22,17 @@ create table llx_socpeople ( - idp int IDENTITY PRIMARY KEY, + idp integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, - fk_soc int, -- lien vers la societe + fk_soc integer, -- lien vers la societe civilite varchar(6), name varchar(50), firstname varchar(50), address varchar(255), cp varchar(25), ville varchar(255), - fk_pays int DEFAULT 0, + fk_pays integer DEFAULT 0, birthday datetime, poste varchar(80), phone varchar(30), @@ -41,7 +41,7 @@ create table llx_socpeople fax varchar(30), email varchar(255), jabberid varchar(255), - fk_user int DEFAULT 0, -- user qui a créé l'enregistrement - fk_user_modif int, + fk_user integer DEFAULT 0, -- user qui a créé l'enregistrement + fk_user_modif integer, note text ); diff --git a/mssql/tables/llx_socstatutlog.sql b/mssql/tables/llx_socstatutlog.sql index 0c84d15bc27..944e0a80494 100644 --- a/mssql/tables/llx_socstatutlog.sql +++ b/mssql/tables/llx_socstatutlog.sql @@ -22,9 +22,9 @@ create table llx_socstatutlog ( - id int IDENTITY PRIMARY KEY, + id integer IDENTITY PRIMARY KEY, datel datetime, - fk_soc int, - fk_statut int, + fk_soc integer, + fk_statut integer, author varchar(30) ); diff --git a/mssql/tables/llx_stock_mouvement.sql b/mssql/tables/llx_stock_mouvement.sql index 5c0597666f2..82e6c3cad5e 100644 --- a/mssql/tables/llx_stock_mouvement.sql +++ b/mssql/tables/llx_stock_mouvement.sql @@ -22,15 +22,15 @@ create table llx_stock_mouvement ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, datem datetime, - fk_product int NOT NULL, - fk_entrepot int NOT NULL, - value int, + fk_product integer NOT NULL, + fk_entrepot integer NOT NULL, + value integer, price float(13) DEFAULT 0, type_mouvement smallint, - fk_user_author int + fk_user_author integer --key(fk_product), --key(fk_entrepot) diff --git a/mssql/tables/llx_stock_valorisation.sql b/mssql/tables/llx_stock_valorisation.sql index 058099079e3..5e944b0fe05 100644 --- a/mssql/tables/llx_stock_valorisation.sql +++ b/mssql/tables/llx_stock_valorisation.sql @@ -22,17 +22,17 @@ create table llx_stock_valorisation ( - rowid int IDENTITY PRIMARY KEY, - tms timestamp, -- date technique mise à jour automatiquement - date_valo datetime, -- date de valorisation - fk_product int NOT NULL, -- id du produit concerne par l'operation + rowid integer IDENTITY PRIMARY KEY, + tms timestamp, -- SMALLDATETIME technique mise à jour automatiquement + date_valo datetime, -- SMALLDATETIME de valorisation + fk_product integer NOT NULL, -- id du produit concerne par l'operation qty_ope float(9), -- quantité de l'operation price_ope float(12), -- prix unitaire du produit concerne par l'operation valo_ope float(12), -- valorisation de l'operation price_pmp float(12), -- valeur PMP de l'operation qty_stock float(9) DEFAULT 0, -- qunatite en stock valo_pmp float(12), -- valorisation du stock en PMP - fk_stock_mouvement int -- id du mouvement de stock + fk_stock_mouvement integer -- id du mouvement de stock --key(fk_product) ); diff --git a/mssql/tables/llx_texts.sql b/mssql/tables/llx_texts.sql index 807dce153d0..508bdd30fce 100644 --- a/mssql/tables/llx_texts.sql +++ b/mssql/tables/llx_texts.sql @@ -22,11 +22,11 @@ create table llx_models ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, type varchar(32), -- Fonction destinee au modele [public] smallint DEFAULT 1 NOT NULL, -- Model publique ou privee - fk_user int, -- Id utilisateur si privee, sinon null + fk_user integer, -- Id utilisateur si privee, sinon null title varchar(128), -- Titre modele content text -- Texte du modele ); diff --git a/mssql/tables/llx_todocomm.sql b/mssql/tables/llx_todocomm.sql index 0aab337a846..6d4b36471a9 100644 --- a/mssql/tables/llx_todocomm.sql +++ b/mssql/tables/llx_todocomm.sql @@ -25,13 +25,13 @@ create table llx_todocomm ( - id int IDENTITY PRIMARY KEY, - datea datetime, -- date de l'action + id integer IDENTITY PRIMARY KEY, + datea datetime, -- SMALLDATETIME de l'action label varchar(50), -- libelle de l'action - fk_user_action int, -- id de la personne qui doit effectuer l'action - fk_user_author int, -- id auteur de l'action - fk_soc int, -- id de la societe auquel est rattachee l'action - fk_contact int, -- id du contact sur laquelle l'action + fk_user_action integer, -- id de la personne qui doit effectuer l'action + fk_user_author integer, -- id auteur de l'action + fk_soc integer, -- id de la societe auquel est rattachee l'action + fk_contact integer, -- id du contact sur laquelle l'action -- doit etre effectuee note text ); diff --git a/mssql/tables/llx_transaction_bplc.sql b/mssql/tables/llx_transaction_bplc.sql index 33ff94f1cdc..441a430abfd 100644 --- a/mssql/tables/llx_transaction_bplc.sql +++ b/mssql/tables/llx_transaction_bplc.sql @@ -22,7 +22,7 @@ create table llx_transaction_bplc ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, ipclient varchar(20), num_transaction varchar(10), @@ -30,7 +30,7 @@ create table llx_transaction_bplc heure_transaction varchar(10), num_autorisation varchar(10), cle_acceptation varchar(5), - code_retour int, - ref_commande int + code_retour integer, + ref_commande integer ); diff --git a/mssql/tables/llx_tva.sql b/mssql/tables/llx_tva.sql index 39314de234b..dde8e16d2bf 100644 --- a/mssql/tables/llx_tva.sql +++ b/mssql/tables/llx_tva.sql @@ -22,10 +22,10 @@ create table llx_tva ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, tms timestamp, - datep datetime, -- date de paiement - datev datetime, -- date de valeur + datep datetime, -- SMALLDATETIME de paiement + datev datetime, -- SMALLDATETIME de valeur amount real NOT NULL DEFAULT 0, label varchar(255), note text diff --git a/mssql/tables/llx_user.sql b/mssql/tables/llx_user.sql index 3ef40c30488..49b1c1ee58e 100644 --- a/mssql/tables/llx_user.sql +++ b/mssql/tables/llx_user.sql @@ -24,7 +24,7 @@ create table llx_user ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, login varchar(24) NOT NULL, @@ -40,13 +40,13 @@ create table llx_user webcal_login varchar(25), module_comm smallint DEFAULT 1, module_compta smallint DEFAULT 1, - fk_societe int, - fk_socpeople int, - fk_member int, + fk_societe integer, + fk_socpeople integer, + fk_member integer, note text DEFAULT NULL, datelastlogin datetime, datepreviouslogin datetime, - egroupware_id int, + egroupware_id integer, ldap_sid varchar(255) DEFAULT NULL, statut tinyint DEFAULT 1, lang varchar(6) @@ -58,26 +58,28 @@ GO CREATE FUNCTION [dbo].[unix_timestamp] ( - @Date datetime + @SMALLDATETIME datetime ) RETURNS datetime AS BEGIN - DECLARE @Result int + DECLARE @Result integer --SET @Result = NULL - --IF @Date IS NOT NULL SET @Result = DATEDIFF(s, '19700101', @Date) + --IF @SMALLDATETIME IS NOT NULL SET @Result = DATEDIFF(s, '19700101', @SMALLDATETIME) - RETURN @Date + RETURN @SMALLDATETIME END +GO + set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO CREATE FUNCTION [dbo].[from_unixtime] ( - @Epoch int + @Epoch integer ) RETURNS datetime AS @@ -86,6 +88,8 @@ BEGIN END +GO + set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO diff --git a/mssql/tables/llx_user_alert.sql b/mssql/tables/llx_user_alert.sql index 56a621ff654..3798dd708d0 100644 --- a/mssql/tables/llx_user_alert.sql +++ b/mssql/tables/llx_user_alert.sql @@ -23,8 +23,8 @@ create table llx_user_alert ( - rowid int IDENTITY PRIMARY KEY, - type int, - fk_contact int, -- pointe sur llx_socpeople - fk_user int + rowid integer IDENTITY PRIMARY KEY, + type integer, + fk_contact integer, -- pointe sur llx_socpeople + fk_user integer ); diff --git a/mssql/tables/llx_user_clicktodial.sql b/mssql/tables/llx_user_clicktodial.sql index 8b2a2595381..c2ce1953579 100644 --- a/mssql/tables/llx_user_clicktodial.sql +++ b/mssql/tables/llx_user_clicktodial.sql @@ -24,7 +24,7 @@ -- create table llx_user_clicktodial ( - fk_user int PRIMARY KEY, + fk_user integer PRIMARY KEY, login varchar(32), pass varchar(64), poste varchar(20) diff --git a/mssql/tables/llx_user_entrepot.sql b/mssql/tables/llx_user_entrepot.sql index 83517932276..04ffe01488d 100644 --- a/mssql/tables/llx_user_entrepot.sql +++ b/mssql/tables/llx_user_entrepot.sql @@ -22,9 +22,9 @@ create table llx_user_entrepot ( - rowid int IDENTITY PRIMARY KEY, - fk_entrepot int, -- pointe sur llx_entrepot - fk_user int, -- pointe sur llx_user + rowid integer IDENTITY PRIMARY KEY, + fk_entrepot integer, -- pointe sur llx_entrepot + fk_user integer, -- pointe sur llx_user consult tinyint, send tinyint ); diff --git a/mssql/tables/llx_user_param.sql b/mssql/tables/llx_user_param.sql index 052c64dd228..32c7cfd6a27 100644 --- a/mssql/tables/llx_user_param.sql +++ b/mssql/tables/llx_user_param.sql @@ -23,7 +23,7 @@ create table llx_user_param ( - fk_user int NOT NULL, + fk_user integer NOT NULL, page varchar(255) NOT NULL, param varchar(64) NOT NULL, value varchar(255) NOT NULL, diff --git a/mssql/tables/llx_user_rights.sql b/mssql/tables/llx_user_rights.sql index 6ba4deb9437..dd3c21b3f02 100644 --- a/mssql/tables/llx_user_rights.sql +++ b/mssql/tables/llx_user_rights.sql @@ -22,9 +22,9 @@ create table llx_user_rights ( - rowid int IDENTITY PRIMARY KEY, - fk_user int NOT NULL, - fk_id int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_user integer NOT NULL, + fk_id integer NOT NULL, ); CREATE UNIQUE INDEX fk_user_fk_id ON llx_user_rights(fk_user, fk_id) diff --git a/mssql/tables/llx_usergroup.sql b/mssql/tables/llx_usergroup.sql index 0bdcd6d3a38..763af5cb1cc 100644 --- a/mssql/tables/llx_usergroup.sql +++ b/mssql/tables/llx_usergroup.sql @@ -23,7 +23,7 @@ create table llx_usergroup ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, tms timestamp, nom varchar(255) NOT NULL UNIQUE, diff --git a/mssql/tables/llx_usergroup_rights.sql b/mssql/tables/llx_usergroup_rights.sql index 87a5d90650f..c925270ab15 100644 --- a/mssql/tables/llx_usergroup_rights.sql +++ b/mssql/tables/llx_usergroup_rights.sql @@ -22,9 +22,9 @@ create table llx_usergroup_rights ( - rowid int IDENTITY PRIMARY KEY, - fk_usergroup int NOT NULL, - fk_id int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_usergroup integer NOT NULL, + fk_id integer NOT NULL, UNIQUE(fk_usergroup,fk_id) ); diff --git a/mssql/tables/llx_usergroup_user.sql b/mssql/tables/llx_usergroup_user.sql index e732357e1cf..14bbdf183cc 100644 --- a/mssql/tables/llx_usergroup_user.sql +++ b/mssql/tables/llx_usergroup_user.sql @@ -22,9 +22,9 @@ create table llx_usergroup_user ( - rowid int IDENTITY PRIMARY KEY, - fk_user int NOT NULL, - fk_usergroup int NOT NULL, + rowid integer IDENTITY PRIMARY KEY, + fk_user integer NOT NULL, + fk_usergroup integer NOT NULL, UNIQUE(fk_user,fk_usergroup) ); diff --git a/mssql/tables/llx_ventes.sql b/mssql/tables/llx_ventes.sql index 93ab5caaf89..7c73d944427 100644 --- a/mssql/tables/llx_ventes.sql +++ b/mssql/tables/llx_ventes.sql @@ -22,11 +22,11 @@ create table llx_ventes ( - rowid int IDENTITY PRIMARY KEY, - fk_soc int NOT NULL, - fk_product int NOT NULL, - dated datetime, -- date debut - datef datetime, -- date fin + rowid integer IDENTITY PRIMARY KEY, + fk_soc integer NOT NULL, + fk_product integer NOT NULL, + dated datetime, -- SMALLDATETIME debut + datef datetime, -- SMALLDATETIME fin price real, author varchar(30), active smallint DEFAULT 0 NOT NULL, diff --git a/mssql/tables/llx_voyage.sql b/mssql/tables/llx_voyage.sql index ac306bd41b9..53a7f90a2f2 100644 --- a/mssql/tables/llx_voyage.sql +++ b/mssql/tables/llx_voyage.sql @@ -27,19 +27,19 @@ create table llx_voyage ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, - dateo datetime, -- date operation - date_depart datetime, -- date du voyage - date_arrivee datetime, -- date du voyage + dateo datetime, -- SMALLDATETIME operation + date_depart datetime, -- SMALLDATETIME du voyage + date_arrivee datetime, -- SMALLDATETIME 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), arrivee varchar(255), fk_type smallint, -- Train, Avion, Bateaux - fk_reduc int, - distance int, -- distance en kilometre + fk_reduc integer, + distance integer, -- distance en kilometre dossier varchar(50), -- numero de dossier note text ); diff --git a/mssql/tables/llx_voyage_reduc.sql b/mssql/tables/llx_voyage_reduc.sql index d4e3baef5ef..2fa165d7ce3 100644 --- a/mssql/tables/llx_voyage_reduc.sql +++ b/mssql/tables/llx_voyage_reduc.sql @@ -22,10 +22,10 @@ create table llx_voyage_reduc ( - rowid int IDENTITY PRIMARY KEY, + rowid integer IDENTITY PRIMARY KEY, datec datetime, - datev datetime, -- date de valeur - date_debut datetime, -- date operation + datev datetime, -- SMALLDATETIME de valeur + date_debut datetime, -- SMALLDATETIME operation date_fin datetime, amount real NOT NULL DEFAULT 0, label varchar(255),