You are here

function votingapi_actions_install in Voting API 5

File

./votingapi_actions.install, line 4

Code

function votingapi_actions_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {votingapi_action_set} (\n          vasid int unsigned NOT NULL,\n          parent int unsigned NOT NULL,\n          name varchar(64) NOT NULL,\n          source varchar(64) default NULL,\n          description varchar(255) default NULL,\n          required int(8) NOT NULL default '0',\n          condition_mask varchar(8) default 'AND',\n          content_type varchar(20) default NULL,\n          weight int(10) NOT NULL default 0,\n          PRIMARY KEY  (vasid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {votingapi_action_condition} (\n          vacid int unsigned NOT NULL,\n          vasid int unsigned NOT NULL,\n          name varchar(64) NOT NULL,\n          description varchar(255) NOT NULL,\n          weight int(10) NOT NULL default 0,\n          data varchar(255),\n          handler varchar(255) NOT NULL,\n          PRIMARY KEY  (vacid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {votingapi_action} (\n          vasid varchar(64) NOT NULL,\n          aid varchar(255) NOT NULL\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {votingapi_action_set} (\n          vasid int NOT NULL,\n          parent int NOT NULL,\n          name varchar(64) NOT NULL,\n          source varchar(64) default NULL,\n          description varchar(255) default NULL,\n          required int4 NOT NULL default 0,\n          condition_mask varchar(8) default 'AND',\n          content_type varchar(20) default NULL,\n          weight int4 NOT NULL default 0,\n          PRIMARY KEY  (name));");
      db_query("CREATE TABLE {votingapi_action_condition} (\n          vacid int NOT NULL,\n          vasid int NOT NULL,\n          name varchar(64) NOT NULL,\n          description varchar(255) NOT NULL,\n          weight int4 NOT NULL default 0,\n          data varchar(255),\n          handler varchar(255) NOT NULL,\n          PRIMARY KEY (name));");
      db_query("CREATE TABLE {votingapi_action} (\n          vasid int NOT NULL,\n          aid varchar(255) NOT NULL);");
      break;
  }
}