You are here

function deploy_install in Deploy - Content Staging 5

Same name and namespace in other branches
  1. 6 deploy.install \deploy_install()
  2. 7.3 deploy.install \deploy_install()

Implementation of hook_install().

File

./deploy.install, line 7

Code

function deploy_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {deploy_plan} (\n        pid int unsigned NOT NULL default '0',\n        name varchar(50) NOT NULL,\n        description text,\n        PRIMARY KEY (pid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {deploy_plan_items} (\n        iid int unsigned NOT NULL default '0',\n        pid int unsigned NOT NULL default '0',\n        module varchar(50) NOT NULL,\n        description varchar(75),\n        weight int NOT NULL default '0',\n        data longtext NOT NULL,\n        uid int NOT NULL,\n        ts int NOT NULL,\n        PRIMARY KEY (iid, pid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {deploy_servers} (\n        sid int unsigned NOT NULL default '0',\n        description varchar(100),\n        url varchar(100),\n        api_key varchar(32),\n        PRIMARY KEY (sid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {deploy_log} (\n        dlid int unsigned NOT NULL,\n        plan varchar(50) NOT NULL,\n        server varchar(100) NOT NULL,\n        username varchar(60) NOT NULL,\n        ts int NOT NULL,\n        PRIMARY KEY (dlid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {deploy_log_details} (\n        dldid int unsigned NOT NULL,\n        dlid int unsigned NOT NULL, \n        module varchar(50) NOT NULL,\n        description varchar(75) NOT NULL,\n        result varchar(25) NOT NULL,\n        message varchar(255) NOT NULL,\n        PRIMARY KEY (dldid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {deploy_plan} (\n        pid int_unsigned NOT NULL default '0',\n        description text,\n        name varchar(50) NOT NULL,\n        PRIMARY KEY (pid)\n      )");
      db_query("CREATE TABLE {deploy_plan_items} (\n        iid int_unsigned NOT NULL default '0',\n        pid int_unsigned NOT NULL default '0',\n        module varchar(50) NOT NULL,\n        description varchar(75),\n        weight int NOT NULL default '0',\n        data text NOT NULL,\n        uid int NOT NULL,\n        ts int NOT NULL,\n        PRIMARY KEY (iid, pid)\n      )");
      db_query("CREATE TABLE {deploy_servers} (\n        sid int_unsigned NOT NULL default '0',\n        description varchar(100),\n        url varchar(100),\n        api_key varchar(32),\n        PRIMARY KEY (sid)\n      )");
      db_query("CREATE TABLE {deploy_log} (\n        dlid int_unsigned NOT NULL,\n        plan varchar(50) NOT NULL,\n        server varchar(100) NOT NULL,\n        username varchar(60) NOT NULL,\n        ts int NOT NULL,\n        PRIMARY KEY (dlid)\n      )");
      db_query("CREATE TABLE {deploy_log_details} (\n        dldid int_unsigned NOT NULL,\n        dlid int_unsigned NOT NULL, \n        module varchar(50) NOT NULL,\n        description varchar(75) NOT NULL,\n        result varchar(25) NOT NULL,\n        message varchar(255) NOT NULL,\n        PRIMARY KEY (dldid)\n      )");
      break;
  }
}