View source
<?php
require_once drupal_get_path('module', 'user_relationships') . '/user_relationships.install';
function user_relationship_implications_install() {
$success = _user_relationships_installation_query(array(
"CREATE TABLE {user_relationship_implications} (\n `riid` int unsigned NOT NULL default 0,\n `rtid` int unsigned NOT NULL default 0,\n `implies_rtid` int unsigned NOT NULL default 0,\n `strict` tinyint(1) NOT NULL default 0,\n `reverse` tinyint(1) NOT NULL default 0,\n PRIMARY KEY (riid),\n KEY `rtid` (rtid),\n KEY `implies_rtid` (implies_rtid)\n ) /*!40100 DEFAULT CHARACTER SET utf8*/;",
), array(
"CREATE TABLE {user_relationship_implications} (\n riid int_unsigned NOT NULL default 0,\n rtid int_unsigned NOT NULL default 0,\n implies_rtid int_unsigned NOT NULL default 0,\n strict smallint NOT NULL default 0,\n reverse smallint NOT NULL default 0,\n PRIMARY KEY (riid)\n )",
"CREATE INDEX {user_relationship_implications}_rtid_idx ON {user_relationship_implications} (rtid)",
"CREATE INDEX {user_relationship_implications}_implies_rtid_idx ON {user_relationship_implications} (implies_rtid)",
"CREATE SEQUENCE {user_relationship_implications}_id_seq",
));
if ($success) {
drupal_set_message(t('User Relationship Implications module installed successfully.'));
}
else {
drupal_set_message(t('The installation of the User Relationship Implications module as unsuccessful.'), 'error');
}
}
function user_relationship_implications_uninstall() {
db_query("DROP TABLE {user_relationship_implications}");
}
function user_relationship_implications_update_1() {
$success = _user_relationships_installation_query(array(
"ALTER TABLE {user_relationship_implications} ADD `strict` tinyint(1) NOT NULL default 0",
));
if ($success) {
drupal_set_message(t('User Relationship Implications module updated successfully.'));
}
else {
drupal_set_message(t('The update of the User Relationship Implications module as unsuccessful.'), 'error');
}
}
function user_relationship_implications_update_2() {
$success = _user_relationships_installation_query(array(
"ALTER TABLE {user_relationship_implications} ADD `reverse` tinyint(1) NOT NULL default 0",
), array(
"ALTER TABLE {user_relationship_implications} ADD reverse smallint NOT NULL default 0",
));
if ($success) {
drupal_set_message(t('User Relationship Implications module updated successfully.'));
}
else {
drupal_set_message(t('The update of the User Relationship Implications module as unsuccessful.'), 'error');
}
}