<?php

/**
 * hook install for addnode.. create table to store the addnode order
 */
function addnode_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
			db_query("CREATE TABLE {addnode_order} (nid int not null default 0, fieldname char(255) not null default '', weights text) /*!40100 DEFAULT CHARACTER SET utf8 */");
			break;
    case 'pgsql':
			db_query("CREATE TABLE {addnode_order} (nid integer not null default 0, fieldname varchar(255) not null default '', weights text)");
			break;
	}
}

/**
 * we are reusing addnode namespace to update function for existing sites.
 */
function addnode_update_1() {
  $ret = array();
	addnode_install();
	return $ret;
}

/**
 * hook_uninstall deletes the support tables.
 **/
function addnode_uninstall() {
	db_query("DROP TABLE {addnode_order}");
}
