currency_api.install in Currency 5
File
currency_api/currency_api.install
View source
<?php
function currency_api_install() {
switch ($GLOBALS['db_type']) {
case 'mysqli':
case 'mysql':
db_query("CREATE TABLE {currencyapi} (\n currency_from varchar(10) NOT NULL default '',\n currency_to varchar(10) NOT NULL default '',\n rate float NOT NULL default '0',\n timestamp int NOT NULL default '0'\n ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
db_query("CREATE TABLE {currencyapi} (\n currency_from varchar(10) NOT NULL default '',\n currency_to varchar(10) NOT NULL default '',\n rate float NOT NULL default '0',\n timestamp int NOT NULL default '0'\n );");
break;
}
}
function currency_api_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'currency_api%'");
db_query('DROP TABLE {currencyapi}');
}
function currency_api_update_1() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysqli':
case 'mysql':
$ret[] = update_sql("ALTER TABLE {currencyapi} CHANGE timestamp timestamp int NOT NULL default '0'");
break;
case 'pgsql':
break;
}
return $ret;
}