weather_es.install in Weather_es 6
Same filename and directory in other branches
Non-displayable characters.
File
weather_es.installView source
<?php
/**
* Implementation of hook_install().
*/
function weather_es_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("\n CREATE TABLE {weather_es_config} (\n uid INT(3) UNSIGNED DEFAULT 0 NOT NULL,\n cod_pro INT(2) UNSIGNED ZEROFILL DEFAULT 0 NOT NULL,\n cod_loc INT(3) UNSIGNED ZEROFILL DEFAULT 0 NOT NULL,\n cit_nam VARCHAR(50) DEFAULT '',\n lan VARCHAR(2) DEFAULT 'es',\n pro_act INT(10) UNSIGNED DEFAULT 0 NOT NULL,\n sky VARCHAR(50) DEFAULT '',\n rain VARCHAR(50) DEFAULT '',\n snow VARCHAR(50) DEFAULT '',\n tmax VARCHAR(50) DEFAULT '',\n tmin VARCHAR(50) DEFAULT '',\n win_dir VARCHAR(50) DEFAULT '',\n win_spd VARCHAR(50) DEFAULT '',\n iv VARCHAR(50) DEFAULT '',\n rsk VARCHAR(50) DEFAULT '',\n PRIMARY KEY(uid, cod_pro, cod_loc))\n /*!40100 DEFAULT CHARACTER SET utf8 */\n ");
db_query("\n CREATE TABLE {weather_es_data} (\n did SMALLINT NOT NULL AUTO_INCREMENT,\n cod_pro INT(2) UNSIGNED ZEROFILL DEFAULT 0 NOT NULL,\n cod_loc INT(3) UNSIGNED ZEROFILL DEFAULT 0 NOT NULL,\n day VARCHAR(15) DEFAULT '',\n ampm VARCHAR(2) DEFAULT '',\n sky_txt1 VARCHAR(50) DEFAULT '',\n sky_txt2 VARCHAR(50) DEFAULT '',\n sky_img1 VARCHAR(25) DEFAULT 'nodata',\n sky_img2 VARCHAR(25) DEFAULT 'nodata',\n rain INT(3) UNSIGNED DEFAULT 999,\n snow INT(4) UNSIGNED DEFAULT 9999,\n tmax INT(2) DEFAULT 99,\n tmin INT(2) DEFAULT 99,\n win_dir1 VARCHAR(50) DEFAULT '',\n win_dir2 VARCHAR(50) DEFAULT '',\n win_spd1 INT(3) UNSIGNED DEFAULT 999,\n win_spd2 INT(3) UNSIGNED DEFAULT 999,\n iv_max INT(2) UNSIGNED DEFAULT 99,\n rsk VARCHAR(50) DEFAULT '',\n PRIMARY KEY(cod_pro, cod_loc, did))\n /*!40100 DEFAULT CHARACTER SET utf8 */\n ");
db_query("\n CREATE TABLE {weather_es_aemet} (\n cod_pro INT(2) UNSIGNED ZEROFILL DEFAULT 0 NOT NULL,\n cod_loc INT(3) UNSIGNED ZEROFILL DEFAULT 0 NOT NULL,\n cit_nam VARCHAR(50) DEFAULT '',\n PRIMARY KEY(cod_pro, cod_loc))\n /*!40100 DEFAULT CHARACTER SET utf8 */\n ");
break;
}
// Insert the AEMET cities code
require_once drupal_get_path('module', 'weather_es') . '/weather_es_data.inc';
_weather_es_fill_aemet_table();
}
/**
* Implementation of hook_uninstall().
*/
function weather_es_uninstall() {
db_query("DROP TABLE {weather_es_config}");
db_query("DROP TABLE {weather_es_data}");
db_query("DROP TABLE {weather_es_aemet}");
}
Functions
Name | Description |
---|---|
weather_es_install | Implementation of hook_install(). |
weather_es_uninstall | Implementation of hook_uninstall(). |