You are here

function relation_class_install in Subform 5

Implementation of hook_install().

File

./relation_class.install, line 7

Code

function relation_class_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("\n        CREATE TABLE {relation_class} (\n          nid INT(11) UNSIGNED NOT NULL,\n          vid INT(11) UNSIGNED NOT NULL,\n          left_node_type VARCHAR(64),\n          left_node_cardinality int(11) UNSIGNED NOT NULL,\n          right_node_type VARCHAR(64),\n          right_node_cardinality int(11) UNSIGNED NOT NULL,\n          unique_instances tinyint(1) NOT NULL,\n          PRIMARY KEY (nid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;\n        ");
      db_query("\n        CREATE TABLE {relation_instance} (\n          id INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n          relation_class INT( 11 ) UNSIGNED NOT NULL,\n          left_node INT( 11 ) NOT NULL,\n          right_node INT( 11 ) NOT NULL,\n          timestamp INT(11) NOT NULL,\n          INDEX ( relation_class , left_node , right_node , timestamp )\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;\n      ");
      break;
    case 'pgsql':
      break;
  }

  // Notify of changes
  drupal_set_message(t('Relation Class successfully installed.'));
  drupal_set_message(t('Relation Instances table successfully installed.'));
}