panier.install
<?php
// $Id: panier.install,v 1.14.2.16.2.24 2008/10/06 05:55:37 quicksketch Exp $
/**
* Implementation of hook_install().
*/
function panier_install() {
$success = TRUE;
switch ($GLOBALS['db_type']) {
case 'mysqli':
case 'mysql':
$success = $success && db_query("CREATE TABLE if not exists {inereach_panier} (
id int(10) NOT NULL auto_increment,
id_prosclt int(12) NOT NULL,
cas varchar(12),
fiche varchar(30),
date date,
PRIMARY KEY (id)
)"
);
$success = $success && db_query("CREATE TABLE if not exists {inereach_suivi} (
id int(10) NOT NULL auto_increment,
id_prosclt int(12) NOT NULL,
cas varchar(12),
fiche varchar(30),
date date,
etat varchar(20),
PRIMARY KEY (id)
)"
);
break;
case 'pgsql':
$success = $success && db_query("CREATE TABLE {inereach_panier} (
id integer NOT NULL auto_increment,
id_prosclt int(12) NOT NULL,
cas varchar(12) NOT NULL default '',
fiche varchar(30) NOT NULL default '',
date date NOT NULL,
PRIMARY KEY (id)
)"
);
$success = $success && db_query("CREATE TABLE {inereach_suivi} (
id integer NOT NULL auto_increment,
id_prosclt int(12) NOT NULL,
cas varchar(12) NOT NULL default '',
fiche varchar(30) NOT NULL default '',
date date NOT NULL,
etat varchar(20) NOT NULL default 'commandé',
PRIMARY KEY (id)
)"
);
break;
}
$success = $success && db_query("UPDATE {system} SET weight = -1 WHERE name='panier' AND type='module'");
if ($success) {
drupal_set_message(t('panier module installed module tables successfully.'));
}
else {
drupal_set_message(t('The installation of panier module was unsuccessful.'), 'error');
}
}
/**
* Implementation of hook_uninstall().
*/
function panier_uninstall() {
// Drop tables.
db_query("DROP TABLE {inereach_panier}");
db_query("DROP TABLE {inereach_suivi}");
}