CREATE TABLE IF NOT EXISTS subdomains (
	id INT AUTO_INCREMENT PRIMARY KEY,
	SubDomain VARCHAR(255) NULL,
	Active INT DEFAULT 1, 
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
); 
 
CREATE TABLE IF NOT EXISTS subdomain_properties (
	id INT AUTO_INCREMENT PRIMARY KEY,
	SubDomain VARCHAR(255) NULL,
	PropertyName VARCHAR(255) NULL, 
	PropertyValue TEXT,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);

/* Subdomain Properties */
INSERT INTO subdomain_properties (SubDomain) VALUES ("www"); 

/* Subdomain Properties */
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","Domain",                 ""); 

INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","EmailUrl",               "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","EmailServer",            "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","AutoEmailLoginUrl",      "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","PaypayServiceUrl",       "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","AppfactoryUrl",          "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","Addresss",               "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","PayPalPort",             "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","PayPalEndPoint",         "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","CertPrivateKeyLocation", "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","CertPublicKeyLocation",  "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","PaypalClientId",         "");
INSERT INTO subdomain_properties (SubDomain,PropertyName,PropertyValue) VALUES ("www","PaypalAppSecret",        "");

CREATE TABLE IF NOT EXISTS email_users ( 
	id INT AUTO_INCREMENT PRIMARY KEY,
	username VARCHAR(255) NULL,
	password VARCHAR(255) NULL,
	domain VARCHAR(255) NULL,
	userid VARCHAR(255) NULL,
	home VARCHAR(255) NULL,
	type INT DEFAULT 1,
	level INT DEFAULT 0,
	category INT DEFAULT 0,
	verified INT DEFAULT 0,
	backupEmail VARCHAR(255) NULL,
	firstname VARCHAR(255) NULL,
	lastname VARCHAR(255) NULL,
	token VARCHAR(255) NULL,
	expiry TIMESTAMP NULL,
	uid VARCHAR(255) NULL,
	gid INT NULL, 
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS email_users_copy (
	id INT AUTO_INCREMENT PRIMARY KEY,
	username VARCHAR(255) NULL,
	password VARCHAR(255) NULL,
	domain VARCHAR(255) NULL,
	userid VARCHAR(255) NULL,
	home VARCHAR(255) NULL,
	type INT DEFAULT 1,
	level INT DEFAULT 0,
	category INT DEFAULT 0,
	verified INT DEFAULT 0, 
	backupEmail VARCHAR(255) NULL,
	firstname VARCHAR(255) NULL,
	lastname VARCHAR(255) NULL,
	token VARCHAR(255) NULL,
	expiry TIMESTAMP NULL,
	uid VARCHAR(255) NULL,
	gid INT NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS admin_users (
	id INT AUTO_INCREMENT PRIMARY KEY,
	Username VARCHAR(255) NULL,
	Email VARCHAR(255) NULL,
	Password VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS application_settings (
	id INT AUTO_INCREMENT PRIMARY KEY,
	category VARCHAR(255) NULL,
	json MEDIUMTEXT,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS webbuilder (
	id INT AUTO_INCREMENT PRIMARY KEY,
	ProjectName VARCHAR(255) NULL,
	ImagesDirectory VARCHAR(255) NULL,
	ImageUploadURL VARCHAR(255) NULL,
	ImageUploadName VARCHAR(255) NULL,
	WebsiteData MEDIUMTEXT,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS receipts (
	id INT AUTO_INCREMENT PRIMARY KEY,
	type VARCHAR(255) NULL,
	name VARCHAR(255) NULL,
	email VARCHAR(255) NULL,
	amount VARCHAR(255) NULL,
	processor VARCHAR(255) NULL,
	receipt MEDIUMTEXT,
	orderId VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS subscribers (
	id INT AUTO_INCREMENT PRIMARY KEY,
	email VARCHAR(255) NULL,
	name INT DEFAULT 1,
	subscribed INT DEFAULT 1,
	subscriptions VARCHAR(255) NULL,
	assigned_from VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS contact_us_form (
	id INT AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NULL,
	email VARCHAR(255) NULL,
	message TEXT,
	assigned_from VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS contact (
	id INT AUTO_INCREMENT PRIMARY KEY,
	type VARCHAR(255) NULL,
	email VARCHAR(255) NULL,
	phone VARCHAR(255) NULL,
	address VARCHAR(255) NULL,
	name VARCHAR(255) NULL,
	message TEXT,
	assigned_from VARCHAR(255) NULL,
	checked INT DEFAULT 0,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS event_rsvp (
	id INT AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NULL,
	PlusOne VARCHAR(255) NULL,
	EventId INT,
	Email VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS event_reminders (
	id INT AUTO_INCREMENT PRIMARY KEY,
	Name VARCHAR(255) NULL,
	CanBeNotified INT DEFAULT 1,
	Notified INT DEFAULT 0,
	Email VARCHAR(255) NULL,
	EventDate TIMESTAMP,
	EventName VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS sponsorships (
	id INT AUTO_INCREMENT PRIMARY KEY,
	Name VARCHAR(255) NULL,
	Type INT DEFAULT 1,
	Available INT DEFAULT 1,
	BasePrice VARCHAR(255) NULL,
	CanAdjust INT DEFAULT 0,
	Description TEXT,
	Image VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);
CREATE TABLE IF NOT EXISTS sponsors (
	id INT AUTO_INCREMENT PRIMARY KEY,
	Name VARCHAR(255) NULL,
	Email VARCHAR(255) NULL,
	CompanyName VARCHAR(255) NULL,
	Approved INT DEFAULT 2,
	Active INT DEFAULT 1,
	SponsorshipId INT NULL,
	Company INT DEFAULT 0,
	Months INT DEFAULT 1,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);

CREATE TABLE IF NOT EXISTS calender (
	id INT AUTO_INCREMENT PRIMARY KEY,
	EventName VARCHAR(255) NULL,
	EventDateStartFormat1 TIMESTAMP NULL,
	EventDateStartFormat2 VARCHAR(255) NULL,
	EventDateStartFormat3 VARCHAR(255) NULL,
	EventDateEndFormat1 TIMESTAMP NULL,
	EventDateEndFormat2 VARCHAR(255) NULL,
	EventDateEndFormat3 VARCHAR(255) NULL,
	EventDescription TEXT,
	EventLocation VARCHAR(255) NULL,
	EventImage VARCHAR(255) NULL,
	RSVPEnabled INT DEFAULT 0,
	ReminderEnabled INT DEFAULT 0,
	Cost VARCHAR(255) NULL,
	date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);



