<?php
// $Id: address.install,v 1.3 2006/05/09 12:23:36 gordon Exp $

/**
 * E-Commerce address module schema
 */
function address_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {ec_address} (
        aid int(11) NOT NULL auto_increment,
        uid int(11) NOT NULL default '0',
        firstname varchar(32) NOT NULL default '',
        lastname varchar(32) NOT NULL default '',
        street1 varchar(64) NOT NULL default '',
        street2 varchar(64) NOT NULL default '',
        zip varchar(10) NOT NULL default '',
        city varchar(32) NOT NULL default '',
        state varchar(32) default NULL,
        country varchar(2) NOT NULL default '',
        phone varchar(64) NOT NULL default '',
        PRIMARY KEY  (aid)
      ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {ec_address} (
        aid serial,
        uid integer NOT NULL default '0',
        firstname varchar(32) NOT NULL default '',
        lastname varchar(32) NOT NULL default '',
        street1 varchar(64) NOT NULL default '',
        street2 varchar(64) NOT NULL default '',
        zip varchar(10) NOT NULL default '',
        city varchar(32) NOT NULL default '',
        state varchar(32) default NULL,
        country varchar(2) NOT NULL default '',
        phone varchar(64) NOT NULL default '',
        PRIMARY KEY (aid)
      )");
      break;
  }
}

