DROP TABLE IF EXISTS `0_person_per`;
CREATE TABLE IF NOT EXISTS `0_person_per` (
  `per_ID` mediumint(9) unsigned NOT NULL AUTO_INCREMENT,
  `per_Title` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_FirstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_MiddleName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_LastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_Suffix` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_Address1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_Address2` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_City` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_State` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_Zip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_Country` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_HomePhone` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_WorkPhone` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_CellPhone` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_Email` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_WorkEmail` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_BirthMonth` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `per_BirthDay` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `per_BirthYear` year(4) DEFAULT NULL,
  `per_MembershipDate` date DEFAULT NULL,
  `per_Gender` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_fmr_ID` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `per_cls_ID` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `per_fam_ID` smallint(5) unsigned NOT NULL DEFAULT '0',
  `per_Envelope` smallint(5) unsigned DEFAULT NULL,
  `per_DateLastEdited` datetime DEFAULT NULL,
  `per_DateEntered` datetime NOT NULL,
  `per_EnteredBy` smallint(5) unsigned NOT NULL DEFAULT '0',
  `per_EditedBy` smallint(5) unsigned DEFAULT '0',
  `per_FriendDate` date DEFAULT NULL,
  `per_Flags` mediumint(9) NOT NULL DEFAULT '0',
  `per_Status` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`per_ID`),
  KEY `per_ID` (`per_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS `0_per_groups`;
CREATE TABLE IF NOT EXISTS `0_per_groups` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(150) NULL,
  `description` VARCHAR(600) NULL,
  `type` VARCHAR(45) NULL,
  `status` VARCHAR(45) NULL,
  PRIMARY KEY (`id`));

DROP TABLE IF EXISTS `0_projects`;
CREATE TABLE IF NOT EXISTS `0_projects` (
  `proj_id` int(11) NOT NULL AUTO_INCREMENT,
  `proj_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `proj_description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `proj_type` tinyint(1) NOT NULL DEFAULT '0',
  `proj_amt` double DEFAULT NULL,
  `proj_ref` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_date` date NOT NULL,
  `closed_date` date DEFAULT NULL,
  `begin_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `owner_id` int(11) NOT NULL,
  `gl_account` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `closed` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`proj_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



DROP TABLE IF EXISTS `0_project_targets`;
CREATE TABLE IF NOT EXISTS `0_project_targets` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `proj_id` VARCHAR(45) NULL,
  `per_Group` VARCHAR(45) NULL,
  `proj_amt` VARCHAR(45) NULL,
  `end_date` VARCHAR(45) NULL,
  PRIMARY KEY (`id`));

DROP TABLE IF EXISTS `0_person_contributions`;
CREATE TABLE IF NOT EXISTS `0_person_contributions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ref` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `per_ID` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `type` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `date` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `due_date` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `bank` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `memo` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
  `inactive` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS `0_contribution_items`;
CREATE TABLE `0_contribution_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contribution_id` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `project` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cont_group` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `amount` double DEFAULT NULL,
  `inactive` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `0_pledge_items`;
CREATE TABLE IF NOT EXISTS `0_pledge_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contribution_id` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `project` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cont_group` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `amount` double DEFAULT NULL,
  `paid_amt` double DEFAULT NULL,
  `inactive` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `0_reflines` (`trans_type`, `prefix`, `pattern`, `description`, `default`, `inactive`) VALUES ('80', '', '{001}/{YYYY}', '', '1', '0');
INSERT INTO `0_reflines` (`trans_type`, `prefix`, `pattern`, `description`, `default`, `inactive`) VALUES ('81', '', '{001}/{YYYY}', '', '1', '0');

DROP TABLE IF EXISTS `0_group_rltn`;
CREATE TABLE IF NOT EXISTS `0_group_rltn` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `per_Group` VARCHAR(45) NULL,
  `person` VARCHAR(45) NULL,
  PRIMARY KEY (`id`));

