DROP TABLE IF EXISTS [db_prefix]upr_records;
CREATE TABLE IF NOT EXISTS [db_prefix]upr_records (
	id int(3) NOT NULL auto_increment,
	id_user int(11) NOT NULL DEFAULT '0' ,
	status enum('approved','new') NOT NULL DEFAULT 'new' ,
	created timestamp(14) NOT NULL ,
	INDEX(id_user),
	PRIMARY KEY (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upr_settings;
CREATE TABLE IF NOT EXISTS [db_prefix]upr_settings (
	id int(3) NOT NULL auto_increment,
	name varchar(255) NOT NULL DEFAULT '' ,
	value varchar(255) NOT NULL DEFAULT '' ,
	default_value varchar(255) NOT NULL DEFAULT '' ,
	INDEX(name),
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upr_settings VALUES ('1','flashcom_server','','');
INSERT INTO [db_prefix]upr_settings VALUES ('2','domain_id','','');
INSERT INTO [db_prefix]upr_settings VALUES ('3','maxrecordseconds','30','30');
INSERT INTO [db_prefix]upr_settings VALUES ('4','audiokbps','22','22');
INSERT INTO [db_prefix]upr_settings VALUES ('5','videokbps','100','100');
INSERT INTO [db_prefix]upr_settings VALUES ('6','videofps','15','15');
INSERT INTO [db_prefix]upr_settings VALUES ('7','videosize','2','2');
INSERT INTO [db_prefix]upr_settings VALUES ('8','autoapprove','true','true');

DROP TABLE IF EXISTS [db_prefix]upm_active_users;
CREATE TABLE [db_prefix]upm_active_users (
	id int(11) NOT NULL auto_increment,
	UserID int(11) NOT NULL default '0',
	lastTimeOnline datetime NOT NULL default '0000-00-00 00:00:00',
	INDEX(UserID),
	PRIMARY KEY (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upm_groups_avdisabled;
CREATE TABLE [db_prefix]upm_groups_avdisabled (
	id int(11) NOT NULL auto_increment,
	id_group int(11) NOT NULL ,
	INDEX(id_group),
	PRIMARY KEY (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upm_pending_wm;
CREATE TABLE [db_prefix]upm_pending_wm (
	originatingUserID int(11) NOT NULL default '0',
	destinationUserID int(11) NOT NULL default '0',
	openedWindowAt datetime default NULL,
	insertedAt datetime NOT NULL default '0000-00-00 00:00:00',
	INDEX(originatingUserID),
	INDEX(destinationUserID)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upm_quick_messages;
CREATE TABLE [db_prefix]upm_quick_messages (
	id int(11) NOT NULL auto_increment,
	title varchar(255) NOT NULL default '',
	body text ,
	created datetime NOT NULL default '0000-00-00 00:00:00',
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upm_quick_messages (title, body, created) VALUES ("Standard Greeting", "I\'m happy to be here!", NOW());

DROP TABLE IF EXISTS [db_prefix]upm_settings;
CREATE TABLE IF NOT EXISTS [db_prefix]upm_settings (
	id int(3) NOT NULL auto_increment,
	name varchar(255) NOT NULL DEFAULT '' ,
	value varchar(255) NOT NULL DEFAULT '' ,
	default_value varchar(255) NOT NULL DEFAULT '' ,
	iscolor enum('0','1') NOT NULL DEFAULT '0' ,
	INDEX(name),
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upm_settings VALUES ('1','flashcom_server','','','0');
INSERT INTO [db_prefix]upm_settings VALUES ('2','domain_id','','','0');
INSERT INTO [db_prefix]upm_settings VALUES ('3','presence_id','','','0');
INSERT INTO [db_prefix]upm_settings VALUES ('4','account_password','','','0');
INSERT INTO [db_prefix]upm_settings VALUES ('5','avenabled','true','true','0');
INSERT INTO [db_prefix]upm_settings VALUES ('6','maxvideobandwidth','20000','20000','0');
INSERT INTO [db_prefix]upm_settings VALUES ('7','connectiontimeout','60','60','0');
INSERT INTO [db_prefix]upm_settings VALUES ('8','characterlimit','200','200','0');
INSERT INTO [db_prefix]upm_settings VALUES ('9','sendtexttoimages','false','false','0');
INSERT INTO [db_prefix]upm_settings VALUES ('10','buttonbarcolor','','','1');
INSERT INTO [db_prefix]upm_settings VALUES ('11','hidedropshadows','false','false','0');
INSERT INTO [db_prefix]upm_settings VALUES ('12','waiting_message','true','true','0');
INSERT INTO [db_prefix]upm_settings VALUES ('13','open_message','true','true','0');
INSERT INTO [db_prefix]upm_settings VALUES ('14','closed_message','true','true','0');
INSERT INTO [db_prefix]upm_settings VALUES ('15','blocked_message','true','true','0');
INSERT INTO [db_prefix]upm_settings VALUES ('16','away_message','true','true','0');
INSERT INTO [db_prefix]upm_settings VALUES ('17','full_banner_zone','','','0');
INSERT INTO [db_prefix]upm_settings VALUES ('18','text_zone','','','0');
INSERT INTO [db_prefix]upm_settings VALUES ('19','ul_banner_zone','','','0');
INSERT INTO [db_prefix]upm_settings VALUES ('20','ul_text_zone','','','0');

DROP TABLE IF EXISTS [db_prefix]upc_active_users;
CREATE TABLE [db_prefix]upc_active_users (
	id int(11) NOT NULL auto_increment,
	id_user int(11) DEFAULT '0' ,
	joined timestamp(14) NOT NULL,
	INDEX(id_user),
	PRIMARY KEY (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upc_announcements;
CREATE TABLE [db_prefix]upc_announcements (
	id int(11) NOT NULL auto_increment,
	message text ,
	created timestamp(14) NOT NULL,
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upc_announcements (message, created) VALUES ("<b>Site Notification:</b> Connect with singles near you for dating, romance and friendship.", NOW());

DROP TABLE IF EXISTS [db_prefix]upc_ban_options;
CREATE TABLE [db_prefix]upc_ban_options (
	id int(11) NOT NULL auto_increment,
	period int(11) DEFAULT '0' ,
	ptype enum('hour','day', 'week', 'month') DEFAULT 'hour' ,
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upc_ban_options (period, ptype) VALUES ('1', 'hour');
INSERT INTO [db_prefix]upc_ban_options (period, ptype) VALUES ('2', 'hour');
INSERT INTO [db_prefix]upc_ban_options (period, ptype) VALUES ('1', 'day');
INSERT INTO [db_prefix]upc_ban_options (period, ptype) VALUES ('1', 'week');
INSERT INTO [db_prefix]upc_ban_options (period, ptype) VALUES ('1', 'month');

DROP TABLE IF EXISTS [db_prefix]upc_ban_users;
CREATE TABLE [db_prefix]upc_ban_users (
	id int(11) NOT NULL auto_increment,
	id_user int(11) NOT NULL DEFAULT '0' ,
	banned timestamp(14) NOT NULL,
	period_int int(11) NOT NULL DEFAULT '0' ,
	period_str varchar(32) NOT NULL default '' ,
	INDEX(id_user),
	PRIMARY KEY (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upc_groups_avdisabled;
CREATE TABLE [db_prefix]upc_groups_avdisabled (
	id int(11) NOT NULL auto_increment,
	id_group int(11) NOT NULL ,
	INDEX(id_group),
	PRIMARY KEY (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upc_moderators;
CREATE TABLE [db_prefix]upc_moderators (
	id int(11) NOT NULL auto_increment,
	id_user int(11) NOT NULL DEFAULT '0' ,
	status enum('0','1') NOT NULL default '0',
	created timestamp(14) NOT NULL,
	INDEX(id_user),
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upc_moderators (id_user, status, created) VALUES ('1', '1', NOW());

DROP TABLE IF EXISTS [db_prefix]upc_rooms;
CREATE TABLE [db_prefix]upc_rooms (
	id int(11) NOT NULL auto_increment,
	id_creator int(11) default NULL,
	name varchar(255) NOT NULL default '',
	description text,
	initialroom enum('0','1') NOT NULL default '0',
	lobby enum('0','1') NOT NULL default '0',
	adminonly enum('0','1') NOT NULL default '0',
	created timestamp(14) NOT NULL,
	INDEX(id_creator),
	INDEX(name),
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upc_rooms (id_creator, name, description, initialroom, lobby, adminonly, created) VALUES ('1', 'Waiting Room', 'Lobby Description', '0', '1', '0', NOW());
INSERT INTO [db_prefix]upc_rooms (id_creator, name, description, initialroom, lobby, adminonly, created) VALUES ('1', 'Lazy People', 'Lazy People Description', '1', '0', '0', NOW());
INSERT INTO [db_prefix]upc_rooms (id_creator, name, description, initialroom, lobby, adminonly, created) VALUES ('1', 'Only Chat Admins', 'Only chat admins can get into this room', '0', '0', '1', NOW());
INSERT INTO [db_prefix]upc_rooms (id_creator, name, description, initialroom, lobby, adminonly, created) VALUES ('1', 'Singles', 'Singles Description', '0', '0', '0', NOW());

DROP TABLE IF EXISTS [db_prefix]upc_rooms_users;
CREATE TABLE [db_prefix]upc_rooms_users (
	id int(11) NOT NULL auto_increment,
	id_user int(11) DEFAULT '0' ,
	room_name int(11) DEFAULT '0' ,
	joined timestamp(14) NOT NULL,
	INDEX(id_user),
	INDEX(room_name),
	PRIMARY KEY (id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]upc_settings;
CREATE TABLE IF NOT EXISTS [db_prefix]upc_settings (
	id int(3) NOT NULL auto_increment,
	name varchar(255) NOT NULL DEFAULT '' ,
	value varchar(255) NOT NULL DEFAULT '' ,
	default_value varchar(255) NOT NULL DEFAULT '' ,
	iscolor enum('0','1') NOT NULL DEFAULT '0' ,
	INDEX(name),
	PRIMARY KEY (id)
) CHARSET=utf8;

INSERT INTO [db_prefix]upc_settings VALUES ('1','flashcom_server','','','0');
INSERT INTO [db_prefix]upc_settings VALUES ('2','domain_id','','','0');
INSERT INTO [db_prefix]upc_settings VALUES ('3','avenabled','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('4','audiokbps','16','16','0');
INSERT INTO [db_prefix]upc_settings VALUES ('5','videokbps','100','100','0');
INSERT INTO [db_prefix]upc_settings VALUES ('6','videofps','15','15','0');
INSERT INTO [db_prefix]upc_settings VALUES ('7','videosize','1','1','0');
INSERT INTO [db_prefix]upc_settings VALUES ('8','videodisplaysize','2','2','0');
INSERT INTO [db_prefix]upc_settings VALUES ('9','maxdockitems','1','1','0');
INSERT INTO [db_prefix]upc_settings VALUES ('10','userroomcreate','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('11','roomemptytimeout','600','600','0');
INSERT INTO [db_prefix]upc_settings VALUES ('12','characterlimit','200','200','0');
INSERT INTO [db_prefix]upc_settings VALUES ('13','maxroomusers','20','20','0');
INSERT INTO [db_prefix]upc_settings VALUES ('14','permitwhisper','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('15','permitcopy','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('16','maxhistorymessages','20','20','0');
INSERT INTO [db_prefix]upc_settings VALUES ('17','session_timeout','-1','-1','0');
INSERT INTO [db_prefix]upc_settings VALUES ('18','show_joinleave_messages','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('19','announcements_interval','5','5','0');
INSERT INTO [db_prefix]upc_settings VALUES ('20','inactivity_timeout','-1','-1','0');
INSERT INTO [db_prefix]upc_settings VALUES ('21','flood_resettime','5','5','0');
INSERT INTO [db_prefix]upc_settings VALUES ('22','flood_interval','5','5','0');
INSERT INTO [db_prefix]upc_settings VALUES ('23','flood_maxmessages','10','10','0');
INSERT INTO [db_prefix]upc_settings VALUES ('24','titlebarcolor','','','1');
INSERT INTO [db_prefix]upc_settings VALUES ('25','scrolltrackcolor','','','1');
INSERT INTO [db_prefix]upc_settings VALUES ('26','outerbackgroundcolor','','','1');
INSERT INTO [db_prefix]upc_settings VALUES ('27','innerbackgroundcolor','','','1');
INSERT INTO [db_prefix]upc_settings VALUES ('28','uifontcolor','','','1');
INSERT INTO [db_prefix]upc_settings VALUES ('29','buttoncolor','','','1');
INSERT INTO [db_prefix]upc_settings VALUES ('30','minichat_bgcolor','FFA500','FFA500','1');
INSERT INTO [db_prefix]upc_settings VALUES ('31','minichat_fgcolor','FFFFFF','FFFFFF','1');
INSERT INTO [db_prefix]upc_settings VALUES ('32','minichat_convbgcolor','FFFFFF','FFFFFF','1');
INSERT INTO [db_prefix]upc_settings VALUES ('33','minichat_convborcolor','00D2FF','00D2FF','1');
INSERT INTO [db_prefix]upc_settings VALUES ('34','minichat_showfooter','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('35','minichat_showdescription','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('36','minichat_showroomname','true','true','0');
INSERT INTO [db_prefix]upc_settings VALUES ('37','minichat_allowtextinput','false','false','0');
INSERT INTO [db_prefix]upc_settings VALUES ('38','leaderboard_zone','','','0');
INSERT INTO [db_prefix]upc_settings VALUES ('39','text_zone','','','0');

DROP TABLE IF EXISTS [db_prefix]fc123_settings;
CREATE TABLE IF NOT EXISTS [db_prefix]fc123_settings (
  extendserver tinyint(1) NOT NULL default '3',
  chatserverpath varchar(255),
  clientlocation varchar(100),
  clientswfname varchar(50),
  chatdatapath varchar(100),
  chatroomname varchar(50),
  primaryhost varchar(50),
  primaryport int(5) default NULL,
  chatgroup varchar(50),
  apikey varchar(32)
) CHARSET=utf8;

INSERT INTO [db_prefix]fc123_settings (extendserver, clientlocation, clientswfname, chatdatapath, chatroomname, primaryhost, primaryport, chatgroup) VALUES (3, '', '', '', '', '', '', '');

DROP TABLE IF EXISTS [db_prefix]flashcoms7_blocks;
CREATE TABLE IF NOT EXISTS [db_prefix]flashcoms7_blocks (
  id int(11) unsigned NOT NULL auto_increment,
  user_id int(11) unsigned NOT NULL,
  block_id int(11) unsigned NOT NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY suppression (user_id,block_id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]flashcoms7_friends;
CREATE TABLE IF NOT EXISTS [db_prefix]flashcoms7_friends (
  id int(11) unsigned NOT NULL auto_increment,
  user_id int(11) unsigned NOT NULL,
  friend_id int(11) unsigned NOT NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY connection (user_id,friend_id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]flashcoms7_users_online;
CREATE TABLE IF NOT EXISTS [db_prefix]flashcoms7_users_online (
  id int(11) unsigned NOT NULL auto_increment,
  user_id int(11) unsigned NOT NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY user_id (user_id)
) CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]flashcoms7_users;
CREATE TABLE IF NOT EXISTS [db_prefix]flashcoms7_users (
  id int(11) unsigned NOT NULL auto_increment,
  login varchar(255) NOT NULL default '',
  password varchar(32) NOT NULL default '',
  email varchar(255) NOT NULL default '',
  gender enum('1','2') NOT NULL default '1',
  age tinyint(3) unsigned NOT NULL default '0',
  about text NOT NULL,
  picture varchar(50) NOT NULL default '',
  last_login int(11) unsigned NOT NULL default '0',
  xstatus varchar(255) NOT NULL,
  last_online datetime NOT NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY login (login)
)CHARSET=utf8;

DROP TABLE IF EXISTS [db_prefix]flashcoms7_user_types;
CREATE TABLE [db_prefix]flashcoms7_user_types (
  id_type int(11) NOT NULL,
  id_fc_type enum('0','1','2') NOT NULL,
  UNIQUE KEY id_type (id_type)
) CHARSET=utf8;

INSERT INTO [db_prefix]flashcoms7_user_types (id_type, id_fc_type) VALUES
(1,	'0'),
(2,	'1');