Location: PHPKode > projects > WB News > install/install.pgsql.php
<?php

/* $Id: install.pgsql.php,v 1.1.2.3 2008/06/21 03:26:03 pmcilwaine Exp $ */

$sql[] = "CREATE TABLE " . TBL_ADMINSECTIONS . " (
	\"sectionid\" bigint,
	\"section\" varchar(250) default NULL,
	\"displayorder\" bigint default 0,
	PRIMARY KEY (\"sectionid\")
	)";

$sql[] = "CREATE UNIQUE INDEX \"section_idx\" ON " . TBL_ADMINSECTIONS . " (\"section\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_adminsections\" START 6";

$sql[] = "CREATE TABLE " . TBL_CATEGORY ." (
	\"id\" bigint,
	\"name\" varchar(150) default NULL,
	\"avatar_name\" varchar(150) default NULL,
	\"avatar_url\" varchar(250) default NULL,
	PRIMARY KEY (\"id\")
	)";

$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_category\"";

$sql[] = "CREATE TABLE " . TBL_CATPERMS ." (
	\"id\" bigint,
	\"catid\" bigint default NULL,
	\"groupid\" bigint default NULL,
	PRIMARY KEY (\"id\")
	)";

$sql[] = "CREATE INDEX \"catperm_catid_idx\" ON " . TBL_CATPERMS . " (\"catid\")";
$sql[] = "CREATE INDEX \"catperm_groupid_idx\" ON " . TBL_CATPERMS . " (\"groupid\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_category_permissions\"";

$sql[] = "CREATE TABLE " . TBL_COMMENTS . " (
	\"id\" bigint,
	\"newsid\" bigint default 0,
	\"message\" text,
	\"name\" varchar(150) default NULL,
	\"userid\" bigint default 0,
	\"email\" varchar(200) default NULL,
	\"ipaddress\" varchar(15) default NULL,
	\"timeposted\" bigint default 0,
	\"is_spam\" smallint default -1,
	PRIMARY KEY (\"id\")
	)";

$sql[] = "CREATE INDEX \"comment_newsid_idx\" ON " . TBL_COMMENTS . " (\"newsid\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_comments\"";

$sql[] = "CREATE TABLE " . TBL_EMOTICON . " (
	\"id\" bigint,
	\"name\" varchar(150) default NULL,
	\"code\" varchar(20) default NULL,
	\"image\" varchar(255) default NULL,
	PRIMARY KEY (\"id\")
	)";

$sql[] = "CREATE UNIQUE INDEX \"emoticon_code_idx\" ON " . TBL_EMOTICON . " (\"code\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_emoticons\" START 10";

$sql[] = "CREATE TABLE " . TBL_MENU ." (
	\"id\" bigint,
	\"created_ts\" timestamp,
	\"modified\" timestamp,
	\"owner\" text,
	\"label\" text,
	\"url\" text,
	\"attrs\" text,
	\"desc\" text,
	\"auth\" text,
	\"parent\" bigint default NULL,
	\"icon\" text,
	PRIMARY KEY (\"id\")
	)";

$sql[] = "CREATE INDEX \"menu_parent_idx\" ON " . TBL_MENU . " (\"parent\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_menu\" START 23";

$sql[] = "CREATE TABLE " . TBL_NEWS ." (
	\"id\" bigint,
	\"catid\" bigint NOT NULL default '0',
	\"userid\" bigint NOT NULL default '0',
	\"title\" varchar(150) NOT NULL default '',
	\"summary\" text NOT NULL,
	\"news\" text NOT NULL,
	\"timeposted\" bigint NOT NULL default '0',
	\"allowcomments\" smallint NOT NULL default '0',
	\"release_date\" date default NULL,
	\"archive_date\" date default NULL,
	\"publish\" bigint default NULL,
	\"ts\" timestamp,
	\"comments_logged_user\" smallint NOT NULL,
	PRIMARY KEY  (\"id\")
	)";

$sql[] = "CREATE INDEX \"news_userid_idx\" ON " . TBL_NEWS . " (\"userid\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_news\"";

$sql[] = "CREATE TABLE " . TBL_NEWSCONFIG . " (
	\"id\" bigint,
	\"sectionid\" bigint default 0,
	\"title\" varchar(150) default NULL,
	\"description\" varchar(200) default NULL,
	\"value\" text,
	\"var\" varchar(100) default NULL,
	\"optionlist\" text,
	\"displayorder\" bigint default 0,
	\"fieldtype\" varchar(12) default NULL,
	\"validate\" text,
	\"show\" bigint default NULL,
	PRIMARY KEY (\"id\")
	)";

$sql[] = "CREATE UNIQUE INDEX \"newsconfig_var_idx\" ON " . TBL_NEWSCONFIG . " (\"var\")";
$sql[] = "CREATE INDEX \"newsconfig_title_idx\" ON " . TBL_NEWSCONFIG . " (\"title\")";
$sql[] = "CREATE INDEX \"newsconfig_description_idx\" ON " . TBL_NEWSCONFIG . " (\"description\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_newsconfig\" START 23";

$sql[] = "CREATE TABLE " . TBL_SEND . " (
	\"id\" bigint,
	\"newsid\" bigint default 0,
	\"time\" bigint default 0,
	\"email_to\" varchar(255) default NULL,
	\"email_from\" varchar(255) default NULL,
	\"message\" text,
	\"ipaddress\" varchar(15) default NULL,
	PRIMARY KEY (\"id\")
	)";

$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_sendfriend\"";

$sql[] = "CREATE TABLE " . TBL_THEMES . " (
	\"themeid\" bigint,
	\"title\" varchar(100) default NULL,
	\"themepath\" varchar(200) default NULL,
	PRIMARY KEY (\"themeid\")
	)";

$sql[] = "CREATE UNIQUE INDEX \"theme_title_idx\" ON " . TBL_THEMES . " (\"title\")";
$sql[] = "CREATE UNIQUE INDEX \"theme_themepath_idx\" ON " . TBL_THEMES . " (\"themepath\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_themes\" START 3";

$sql[] = "CREATE TABLE "  . TBL_UGROUPS . " (
	\"usergroupid\" bigint,
	\"title\" varchar(100) default NULL,
	\"group_bit\" bigint default NULL,
	PRIMARY KEY (\"usergroupid\")
	)";

$sql[] = "CREATE UNIQUE INDEX \"ugroups_title_idx\" ON " . TBL_UGROUPS . " (\"title\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_usergroups\" START 4";

$sql[] = "CREATE TABLE " . TBL_USERS . " (
	\"userid\" bigint,
	\"usergroupid\" bigint default 0,
	\"username\" varchar(100) default NULL,
	\"password\" varchar(100) default NULL,
	\"postname\" varchar(100) default NULL,
	\"email\" varchar(150) default NULL,
	PRIMARY KEY (\"userid\")
	)";

$sql[] = "CREATE INDEX \"users_usergroupid_idx\" ON " . TBL_USERS . " (\"usergroupid\")";
$sql[] = "CREATE SEQUENCE \"" . SEQ_PREFIX . "seq_users\"";

?>
Return current item: WB News