From 4a43099692b176f67a2be637824ff29a71327e4a Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 16 Jan 2011 02:05:18 +0000
Subject: [PATCH] Fix: Works with mysql 5.5

---
 .../install/mysql/migration/2.0.0-2.1.0.sql   | 32 +++++++++----------
 .../install/mysql/migration/2.1.0-2.2.0.sql   | 22 ++++++-------
 .../install/mysql/migration/2.2.0-2.4.0.sql   | 22 ++++++-------
 .../install/mysql/migration/2.6.0-2.7.0.sql   |  2 +-
 .../install/mysql/migration/2.7.0-2.8.0.sql   |  8 ++---
 .../install/mysql/migration/2.8.0-2.9.0.sql   |  6 ++--
 6 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/htdocs/install/mysql/migration/2.0.0-2.1.0.sql b/htdocs/install/mysql/migration/2.0.0-2.1.0.sql
index 32f9c7c532e..de0e29d1cfd 100644
--- a/htdocs/install/mysql/migration/2.0.0-2.1.0.sql
+++ b/htdocs/install/mysql/migration/2.0.0-2.1.0.sql
@@ -131,7 +131,7 @@ create table llx_product_det
   label          varchar(255) NOT NULL,
   description    text,
   note           text
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE `llx_propal` ADD `date_livraison` DATE;
 ALTER TABLE `llx_commande` ADD `date_livraison` DATE;
@@ -247,7 +247,7 @@ create table llx_societe_adresse_livraison
   note               text,
   fk_user_creat      integer,
   fk_user_modif      integer
-)type=innodb;
+)ENGINE=innodb;
 
 alter table llx_societe_adresse_livraison add column label varchar(30) after tms;
 
@@ -595,7 +595,7 @@ create table llx_livraison
 
   UNIQUE INDEX (ref),
   key(fk_commande)
-)type=innodb;
+)ENGINE=innodb;
 
 alter table llx_livraison drop foreign key fk_livraison_societe;
 alter table llx_livraison drop column fk_soc;
@@ -609,7 +609,7 @@ create table llx_livraisondet
   qty               real,
   key(fk_livraison),
   key(fk_commande_ligne)
-)type=innodb;
+)ENGINE=innodb;
 
 
 insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (90, 'commande',  'internal', 'SALESREPSIGN',  'Commercial signataire de la commande', 1);
@@ -673,7 +673,7 @@ create table llx_societe_remise_except
   fk_user         integer NOT NULL,
   fk_facture      integer,
   description     varchar(255) NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 alter table llx_societe_remise_except ADD COLUMN amount_tva real DEFAULT 0 NOT NULL after amount_ht;
 alter table llx_societe_remise_except ADD COLUMN amount_ttc real DEFAULT 0 NOT NULL after amount_tva;
@@ -786,7 +786,7 @@ create table llx_accountingdebcred
  fk_account      integer		NOT NULL,
 	amount          real		NOT NULL,
 	direction       varchar(1)	NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 alter table llx_facturedet_rec add column total_ht real;
 alter table llx_facturedet_rec add column total_tva real;
@@ -821,7 +821,7 @@ create table llx_categorie_fournisseur
   fk_categorie  integer NOT NULL,
   fk_societe    integer NOT NULL,
   UNIQUE (fk_categorie, fk_societe)
-)type=innodb;
+)ENGINE=innodb;
 
 
 create table llx_fournisseur_ca
@@ -831,7 +831,7 @@ create table llx_fournisseur_ca
   year          smallint UNSIGNED,
   ca_genere     float,
   UNIQUE (fk_societe, year)
-)type=innodb;
+)ENGINE=innodb;
 
 alter table llx_fournisseur_ca add ca_achat float(11,2) DEFAULT 0;
 
@@ -842,7 +842,7 @@ create table llx_product_ca
   year          smallint UNSIGNED,
   ca_genere     float,
   UNIQUE (fk_product, year)
-)type=innodb;
+)ENGINE=innodb;
 
 create table llx_commande_fournisseur_dispatch
 (
@@ -853,7 +853,7 @@ create table llx_commande_fournisseur_dispatch
   fk_entrepot    integer,
   fk_user        integer,
   datec          datetime
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX (fk_commande);
 
@@ -872,7 +872,7 @@ create table llx_stock_valorisation
   fk_stock_mouvement integer,               -- id du mouvement de stock
 
   key(fk_product)
-)type=innodb;
+)ENGINE=innodb;
 
 
 create table llx_entrepot_valorisation
@@ -883,7 +883,7 @@ create table llx_entrepot_valorisation
   fk_entrepot     integer UNSIGNED NOT NULL ,
   valo_pmp        float(12,4),    -- valoristaion du stock en PMP
   key(fk_entrepot)
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_entrepot ADD COLUMN valo_pmp float(12,4) DEFAULT 0;
 
@@ -894,7 +894,7 @@ create table llx_user_entrepot
   fk_user      integer UNSIGNED, -- pointe sur llx_user
   consult      tinyint(1) UNSIGNED,
   send         tinyint(1) UNSIGNED
-)type=innodb;
+)ENGINE=innodb;
 
 create table llx_product_subproduct
 (
@@ -902,7 +902,7 @@ create table llx_product_subproduct
   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)
-)type=innodb;
+)ENGINE=innodb;
 
 create table llx_bordereau_cheque
 (
@@ -916,7 +916,7 @@ create table llx_bordereau_cheque
   fk_user_author    integer,
   note              text,
   statut            tinyint(1) UNSIGNED DEFAULT 0
-)type=innodb;
+)ENGINE=innodb;
 
 alter table llx_product_price add price_level tinyint(4) NULL DEFAULT 1;
 alter table llx_product_price add column price_ttc float(12,4) DEFAULT 0 after price;
@@ -934,7 +934,7 @@ create table llx_export_model
   	label         varchar(50) NOT NULL,
   	type          varchar(20) NOT NULL,
   	field         text
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER table llx_export_model add fk_user		  integer DEFAULT 0 NOT NULL after rowid;
 
diff --git a/htdocs/install/mysql/migration/2.1.0-2.2.0.sql b/htdocs/install/mysql/migration/2.1.0-2.2.0.sql
index b78bd1d42dc..b06aaedfe95 100644
--- a/htdocs/install/mysql/migration/2.1.0-2.2.0.sql
+++ b/htdocs/install/mysql/migration/2.1.0-2.2.0.sql
@@ -149,7 +149,7 @@ create table `llx_categorie_societe` (
   `fk_societe` int(11) not null,
   UNIQUE KEY `fk_categorie` (`fk_categorie`,`fk_societe`),
   KEY `fk_societe` (`fk_societe`)
-) type=innodb;
+) ENGINE=innodb;
 
 alter table `llx_categorie_societe` drop foreign key fk_societe;
 alter table `llx_categorie_societe` add constraint `fk_categorie_societe_categorie_rowid` foreign key(`fk_categorie`) REFERENCES `llx_categorie` (`rowid`);
@@ -161,7 +161,7 @@ create table `llx_categorie_product` (
   PRIMARY KEY  (`fk_categorie`,`fk_product`),
   KEY `idx_categorie_product_fk_categorie` (`fk_categorie`),
   KEY `idx_categorie_product_fk_product` (`fk_product`)
-) type=innodb;
+) ENGINE=innodb;
 
 alter table `llx_categorie_product`
   add constraint `fk_categorie_product_categorie_rowid` foreign key(`fk_categorie`) REFERENCES `llx_categorie` (`rowid`),
@@ -179,7 +179,7 @@ create table `llx_droitpret_rapport` (
   `fichier` varchar(255) NOT NULL,
   `nbfact` int(11) NOT NULL,
   PRIMARY KEY  (`rowid`)
-) type=innodb;
+) ENGINE=innodb;
 
 
 -- Gestion des menu
@@ -199,13 +199,13 @@ CREATE TABLE `llx_menu` (
   `right` varchar(255),
   `user` tinyint(4) NOT NULL default '0',
   PRIMARY KEY  (`rowid`)
-) type=innodb;
+) ENGINE=innodb;
 
 create table `llx_menu_constraint` (
   `rowid` int(11) NOT NULL,
   `action` varchar(255) NOT NULL,
   PRIMARY KEY  (`rowid`)
-) type=innodb;
+) ENGINE=innodb;
 
 create table `llx_menu_const` (
   `rowid` int(11) NOT NULL auto_increment,
@@ -213,7 +213,7 @@ create table `llx_menu_const` (
   `fk_constraint` int(11) NOT NULL,
   `user` tinyint(4) NOT NULL default '2',
   PRIMARY KEY  (`rowid`)
-) type=innodb;
+) ENGINE=innodb;
 
 ALTER TABLE `llx_menu_const` ADD INDEX `idx_menu_const_fk_menu` (`fk_menu`);
 ALTER TABLE `llx_menu_const` ADD INDEX `idx_menu_const_fk_constraint` (`fk_constraint`);
@@ -878,7 +878,7 @@ create table llx_c_ecotaxe
   organization varchar(255),
   fk_pays      integer NOT NULL,
   active       tinyint DEFAULT 1  NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (1, 'ER-A-A', 'Mat�riels �lectriques < 0,2kg', 0.01000000, 'ERP', 1, 1);
 INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (2, 'ER-A-B', 'Mat�riels �lectriques >= 0,2 kg et < 0,5 kg', 0.03000000, 'ERP', 1, 1);
@@ -946,7 +946,7 @@ create table llx_fichinterdet
   description       text,
   duree             integer,
   rang              integer DEFAULT 0
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_fichinter ADD COLUMN model_pdf varchar(50) after note_public;
 
@@ -1010,7 +1010,7 @@ create table llx_c_barcode_type
   libelle  varchar(50)        NOT NULL,
   coder    integer            NOT NULL DEFAULT 0,
   example  varchar(16)        NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (1, 'EAN8', 'EAN8', 0, '1234567');
 INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (2, 'EAN13', 'EAN13', 0, '123456789012');
@@ -1031,7 +1031,7 @@ create table llx_c_paper_format
   height   float(6,2)                       DEFAULT 0,
   unit     enum('mm','cm','point','inch')   NOT NULL,
   active   tinyint DEFAULT 1                NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (1, '4A0', 'Format 4A0', '1682', '2378', 'mm', 1);
 INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (2, '2A0', 'Format 2A0', '1189', '1682', 'mm', 1);
@@ -1062,7 +1062,7 @@ create table llx_societe_log
   fk_user     integer,
   author      varchar(30),
   label       varchar(128)
-)type=innodb;
+)ENGINE=innodb;
 
 
 -- Pour la Tunisie (Formes les plus utilisees)
diff --git a/htdocs/install/mysql/migration/2.2.0-2.4.0.sql b/htdocs/install/mysql/migration/2.2.0-2.4.0.sql
index 2a7959bf872..1ddfd0e6640 100644
--- a/htdocs/install/mysql/migration/2.2.0-2.4.0.sql
+++ b/htdocs/install/mysql/migration/2.2.0-2.4.0.sql
@@ -69,7 +69,7 @@ create table llx_co_exp
 
   key(fk_commande),
   key(fk_expedition)
-)type=innodb;
+)ENGINE=innodb;
 
 -- V4 ALTER TABLE llx_expedition DROP INDEX fk_expedition_methode;
 -- V4 ALTER TABLE llx_expedition DROP INDEX fk_commande;
@@ -119,7 +119,7 @@ create table llx_co_liv
 
   key(fk_commande),
   key(fk_livraison)
-)type=innodb;
+)ENGINE=innodb;
 
 -- V4 ALTER TABLE llx_livraison DROP INDEX fk_commande;
 -- V4 ALTER TABLE llx_livraison DROP INDEX ref;
@@ -162,7 +162,7 @@ create table llx_pr_exp
 
   key(fk_propal),
   key(fk_expedition)
-)type=innodb;
+)ENGINE=innodb;
 
 create table llx_pr_liv
 (
@@ -172,7 +172,7 @@ create table llx_pr_liv
 
   key(fk_propal),
   key(fk_livraison)
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_paiement modify fk_bank integer NOT NULL DEFAULT 0;
 
@@ -184,7 +184,7 @@ create table llx_element_element
   sourcetype		varchar(12) NOT NULL,
   targetid			integer NOT NULL,
   targettype		varchar(12) NOT NULL
-) type=innodb;
+) ENGINE=innodb;
 
 
 ALTER TABLE llx_element_element 
@@ -207,7 +207,7 @@ create table llx_events
   description    varchar(250) NOT NULL,        
   ip			 varchar(32) NOT NULL,
   fk_object      integer               
-) type=innodb;
+) ENGINE=innodb;
 
 
 ALTER TABLE llx_events ADD INDEX idx_events_dateevent (dateevent);
@@ -230,7 +230,7 @@ create table llx_c_prospectlevel
   label           varchar(30),
   sortorder       smallint,
   active          smallint    DEFAULT 1 NOT NULL
-) type=innodb;
+) ENGINE=innodb;
 
 insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_UNKOWN',    'Unknown',  1);
 insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_LOW',       'Low',      2);
@@ -277,7 +277,7 @@ create table llx_ecm_directories
   date_m		  timestamp,
   fk_user_c		  integer,
   fk_user_m		  integer
-) type=innodb;
+) ENGINE=innodb;
 
 create table llx_ecm_documents
 (
@@ -297,7 +297,7 @@ create table llx_ecm_documents
   fk_directory    integer,
   fk_status		  smallint DEFAULT 0,
   private         smallint DEFAULT 0
-) type=innodb;
+) ENGINE=innodb;
 
 ALTER TABLE llx_bank modify num_chq varchar(50);
 
@@ -326,7 +326,7 @@ create table llx_c_type_fees
   code      varchar(12)  UNIQUE NOT NULL,
   libelle   varchar(30),
   active    tinyint DEFAULT 1   NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 
 alter table llx_deplacement modify type varchar(12) NOT NULL;
@@ -343,7 +343,7 @@ alter table llx_element_element modify targettype		varchar(16) NOT NULL;
 
 update llx_societe set fk_typent = 0 where fk_typent is null;
 
-ALTER TABLE llx_surveys_answers_summary TYPE=INNODB;
+ALTER TABLE llx_surveys_answers_summary ENGINE=innodb;
 
 
 -- Not used. Just to be compatible with upgrade process of higher versions
diff --git a/htdocs/install/mysql/migration/2.6.0-2.7.0.sql b/htdocs/install/mysql/migration/2.6.0-2.7.0.sql
index 22b40161df6..c10195ffd9b 100644
--- a/htdocs/install/mysql/migration/2.6.0-2.7.0.sql
+++ b/htdocs/install/mysql/migration/2.6.0-2.7.0.sql
@@ -24,7 +24,7 @@ create table llx_import_model
   	label         varchar(50) NOT NULL,
   	type		  varchar(20) NOT NULL,
   	field         text NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 update llx_bank_url set type='banktransfert' where type='?' and label='(banktransfert)';
 
diff --git a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql b/htdocs/install/mysql/migration/2.7.0-2.8.0.sql
index b5f309860c3..adaa7179d55 100755
--- a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql
+++ b/htdocs/install/mysql/migration/2.7.0-2.8.0.sql
@@ -68,7 +68,7 @@ create table llx_extra_fields
   maxlength 			integer,
   options 				varchar(45),
   rank 					integer
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_extra_fields ADD UNIQUE INDEX idx_extra_fields_name (name, entity);
 
@@ -80,7 +80,7 @@ create table llx_extra_fields_options
   fk_extra_fields 		integer NOT NULL,
   value 				varchar(255) NOT NULL,
   rank 					integer
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_extra_fields_options ADD INDEX idx_extra_fields_options_fk_extra_fields (fk_extra_fields);
 ALTER TABLE llx_extra_fields_options ADD CONSTRAINT fk_extra_fields_options_fk_extra_fields FOREIGN KEY (fk_extra_fields) REFERENCES llx_extra_fields (rowid);
@@ -98,7 +98,7 @@ create table llx_extra_fields_values
   value					varchar(255),
   fk_user_create 		integer,
   fk_user_modif 		integer
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_extra_fields_values ADD INDEX idx_extra_fields_values_fk_extra_fields (fk_extra_fields, entity);
 ALTER TABLE llx_extra_fields_values ADD CONSTRAINT fk_extra_fields_values_fk_extra_fields FOREIGN KEY (fk_extra_fields) REFERENCES llx_extra_fields (rowid);
@@ -185,7 +185,7 @@ create table llx_entity
   fk_user_creat		integer,
   visible			tinyint DEFAULT 1 NOT NULL,
   active			tinyint DEFAULT 1 NOT NULL
-) type=innodb;
+) ENGINE=innodb;
 
 INSERT INTO llx_entity (rowid, label, description, datec, fk_user_creat, visible, active) VALUES (1, 'Default Entity', 'This is the default entity', NOW(), 1, 1, 1);
 
diff --git a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql
index a1df835697d..5cec42f1b7a 100755
--- a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql
+++ b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql
@@ -18,7 +18,7 @@ create table llx_product_association
   fk_product_pere       integer NOT NULL DEFAULT 0,
   fk_product_fils       integer NOT NULL DEFAULT 0,
   qty                   double NULL
-)type=innodb;
+)ENGINE=innodb;
 
 
 ALTER TABLE llx_product_association ADD UNIQUE INDEX uk_product_association (fk_product_pere, fk_product_fils);
@@ -192,7 +192,7 @@ create table llx_c_field_list
   search		tinyint 		DEFAULT 0  	NOT NULL,
   enabled       varchar(255)	DEFAULT 1,
   rang      	integer 		DEFAULT 0
-)type=innodb;
+)ENGINE=innodb;
 
 INSERT INTO llx_c_field_list (rowid, element, entity, name, alias, title, align, sort, search, enabled, rang) VALUES
 (1, 'product_default', 1, 'p.ref', 'ref', 'Ref', 'left', 1, 1, '1', 1),
@@ -222,7 +222,7 @@ create table llx_categorie_member
 (
   fk_categorie  integer NOT NULL,
   fk_member     integer NOT NULL
-)type=innodb;
+)ENGINE=innodb;
 
 ALTER TABLE llx_categorie_member ADD PRIMARY KEY (fk_categorie, fk_member);
 ALTER TABLE llx_categorie_member ADD INDEX idx_categorie_member_fk_categorie (fk_categorie);
-- 
GitLab