drop table if exists `{DBPREFIX}action_logs`, `{DBPREFIX}migrations`; -- split -- create table `{DBPREFIX}action_logs` ( `id` int(11) not null auto_increment primary key, `timestamp` int(11) not null, `user_id` int(11) not null, `action` varchar(255) not null, `message` text not null, `item_id` int(11) not null ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}clients`; -- split -- create table `{DBPREFIX}clients` ( `id` int(11) unsigned not null auto_increment, `first_name` varchar(64) default '', `last_name` varchar(64) default '', `title` varchar(64) default '', `email` varchar(1024) default '', `company` varchar(128) default '', `address` text, `phone` varchar(64) default '', `fax` varchar(64) default '', `mobile` varchar(64) default '', `website` varchar(128) default '', `language` varchar(255) default '', `business_identity` int(255), `can_create_support_tickets` tinyint(1) not null default '0', `profile` text, `unique_id` varchar(10) default '', `passphrase` varchar(32) default '', `created` datetime not null, `support_user_id` int(10) not null default '0', `modified` timestamp on update current_timestamp not null default CURRENT_TIMESTAMP, `owner_id` int(255) unsigned not null default '0', `default_currency_code` varchar(3) default null, `has_custom_tax_ids` tinyint(1) not null default '0', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- create table if not exists `{DBPREFIX}client_ticket_support_rate_matrix` ( `id` int(10) unsigned not null auto_increment, `client_id` int(10) not null, `priority_id` int(10) not null, `rate` float(10, 2) not null, `tax_id` int(255) not null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}contact_log`; -- split -- create table if not exists `{DBPREFIX}contact_log` ( `id` int unsigned not null auto_increment, `client_id` int unsigned not null, `user_id` int unsigned not null, `method` enum ('phone', 'email') not null, `contact` varchar(255) not null, `subject` varchar(255) not null, `content` text, `sent_date` int(10) unsigned not null, `duration` int(11) not null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_timers`; -- split -- create table `{DBPREFIX}project_timers` ( `id` int(10) unsigned not null auto_increment, `start_timestamp` int(255) not null, `last_modified_timestamp` int(255) not null, `current_seconds` int(255) not null, `task_id` int(255) unsigned not null, `user_id` int(255) not null default '0', `pauses_json` longtext null, `is_paused` tinyint(1) not null default '0', `is_over` tinyint(1) not null default '0', primary key (`id`), index task_id (`task_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_templates`; -- split -- create table `{DBPREFIX}project_templates` ( `id` int(11) not null auto_increment, `client_id` varchar(10) null default null, `name` varchar(255) not null, `description` text null default null, `rate` decimal(10, 2) null default null, `currency_id` int(11) null default null, `exchange_rate` float(10, 5) not null, `is_viewable` tinyint(1) not null, `is_timesheet_viewable` tinyint(1) not null default '0', `projected_hours` float not null default '0', `is_flat_rate` tinyint(1) not null default '0', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}notifications`; -- split -- create table `{DBPREFIX}notifications` ( `id` int(11) not null auto_increment, `context` varchar(255) not null, `context_id` int(11) not null, `message` text not null, `seen` tinyint(1) not null default '0', `created` int(11) not null, `action` varchar(255) null, `user_id` int(255) null, `client_id` int(255) null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_task_templates`; -- split -- create table `{DBPREFIX}project_task_templates` ( `id` int(11) not null auto_increment, `project_id` int(11) not null, `parent_id` int(11) null default null, `assigned_user_id` int(11) null default null, `name` varchar(255) not null, `rate` decimal(10, 2) null default null, `hours` decimal(10, 2) null default null, `notes` text null default null, `milestone_id` int(10) not null default '0', `is_viewable` tinyint(1) not null default '0', `is_timesheet_viewable` tinyint(1) default null, `order` int(11) unsigned not null default '0', `projected_hours` float not null default '0', `status_id` int(255) default '0', `is_flat_rate` tinyint(1) not null default '0', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}currencies`; -- split -- create table `{DBPREFIX}currencies` ( `id` int(5) unsigned not null auto_increment, `name` varchar(200) default '', `code` varchar(3) not null, `rate` float default '0', `format` varchar(190) not null default '{"symbol":"before","decimal":".","thousand":",","decimals":2}', primary key (`id`), key `code` (`code`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}files`; -- split -- create table `{DBPREFIX}files` ( `id` int(11) not null auto_increment, `invoice_unique_id` varchar(190) not null, `orig_filename` varchar(255) not null, `real_filename` text not null, `download_count` int(5) default '0', primary key (`id`), key `invoice_unique_id` (`invoice_unique_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}gateway_fields`; -- split -- create table `{DBPREFIX}gateway_fields` ( `gateway` varchar(190) not null, `field` varchar(190) not null, `value` text not null, `type` varchar(255) not null, `business_identity_id` int(11) unsigned default null, key `gateway` (`gateway`), key `field` (`field`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}groups`; -- split -- create table `{DBPREFIX}groups` ( `id` mediumint(8) unsigned not null auto_increment, `name` varchar(20) not null, `description` varchar(100) not null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}items`; -- split -- create table `{DBPREFIX}items` ( `id` int(11) not null auto_increment, `name` varchar(255) not null, `description` text not null, `qty` float not null default '1', `rate` float not null default '0', `tax_id` int(11) not null, `type` varchar(128), primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}keys`; -- split -- create table `{DBPREFIX}keys` ( `id` int(11) not null auto_increment, `key` varchar(40) not null, `level` int(2) not null, `ignore_limits` tinyint(1) not null default '0', `is_private_key` tinyint(1) not null default '0', `ip_addresses` text null default null, `note` text null default null, `date_created` int(11) not null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}logs`; -- split -- create table `{DBPREFIX}logs` ( `id` int(11) not null auto_increment, `uri` varchar(255) not null, `method` varchar(6) not null, `params` text default null, `api_key` varchar(40) not null, `ip_address` varchar(45) not null, `time` int(11) not null, `rtime` float default null, `authorized` tinyint(1) not null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}taxes`; -- split -- create table `{DBPREFIX}taxes` ( `id` int(5) unsigned not null auto_increment, `name` varchar(200) default '', `value` float default '0', `reg` varchar(100) default '', `is_compound` tinyint(1) not null default '0', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- insert into `{DBPREFIX}taxes` (name, value) values ('Default', '{TAX_RATE}'); -- split -- drop table if exists `{DBPREFIX}hidden_notifications`; -- split -- create table `{DBPREFIX}hidden_notifications` ( `user_id` int(11) not null, `notification_id` varchar(150) not null, index (`user_id`, `notification_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}assignments`; -- split -- create table `{DBPREFIX}assignments` ( `user_id` int(11) not null, `item_id` int(11) not null, `item_type` varchar(150) not null default '', `can_read` tinyint(1) not null, `can_update` tinyint(1) not null, `can_delete` tinyint(1) not null, `can_generate_from_project` tinyint(1) not null, `can_send` tinyint(1) not null, key `user_id` (`user_id`), key `item_id` (`item_id`), key `item_type` (`item_type`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}invoice_rows`; -- split -- create table `{DBPREFIX}invoice_rows` ( `id` int(11) not null auto_increment, `unique_id` varchar(190) not null, `name` varchar(255) default '', `description` text, `qty` float default '0', `tax_id` int(5) default '0', `rate` varchar(255) default '', `period` decimal(10, 2) default null, `total` varchar(255) default '', `sort` smallint(4) not null default '0', `type` varchar(128), `item_type_id` int(255) not null default '0', `discount` decimal(65, 10) not null default '0.0000000000', `discount_is_percentage` tinyint(1) not null default '0', `item_type_table` varchar(255) not null default '', primary key (`id`), index unique_id (`unique_id`) ) engine = InnoDB default charset = utf8; -- split -- create table `{DBPREFIX}invoice_rows_taxes` ( `id` int(11) unsigned not null auto_increment, `tax_id` int(11) unsigned not null default 0, `invoice_row_id` int(11) unsigned not null default 0, primary key (`id`), key `tax_id` (`tax_id`), key `invoice_row_id` (`invoice_row_id`) ) engine = InnoDB default charset = utf8; -- split -- create table if not exists `{DBPREFIX}items_taxes` ( `id` int(11) unsigned not null auto_increment, `tax_id` int(11) unsigned not null default 0, `item_id` int(11) unsigned not null default 0, primary key (`id`), key `tax_id` (`tax_id`), key `item_id` (`item_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}meta`; -- split -- create table `{DBPREFIX}meta` ( `id` mediumint(8) unsigned not null auto_increment, `user_id` mediumint(8) unsigned not null, `first_name` varchar(50) default '', `last_name` varchar(50) default '', `company` varchar(100) default '', `phone` varchar(20) default '', `custom_background` varchar(255), `last_visited_version` varchar(48) default '', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}notes`; -- split -- create table `{DBPREFIX}notes` ( `id` int(11) not null auto_increment, `client_id` int(11) not null, `note` text not null, `submitted` timestamp not null default CURRENT_TIMESTAMP, primary key (`id`), key `client_id` (`client_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}invoices`; -- split -- create table `{DBPREFIX}invoices` ( `id` int(11) not null auto_increment, `unique_id` varchar(10) default '', `client_id` int(11) default '0', `amount` decimal(20, 10) null default '0', `due_date` int(11) default '0', `invoice_number` varchar(255) default '', `notes` text, `description` text, `txn_id` varchar(255) default '', `payment_gross` float default '0', `item_name` varchar(255) default '', `payment_hash` varchar(32) default '', `payment_status` varchar(255) default '', `payment_type` varchar(255) default '', `payment_date` int(11) default '0', `payer_status` varchar(255) default '', `type` enum ('SIMPLE', 'DETAILED', 'ESTIMATE', 'CREDIT_NOTE') default 'DETAILED', `date_entered` int(11) default '0', `is_paid` tinyint(1) default '0', `is_recurring` tinyint(1) default '0', `frequency` varchar(2), `auto_send` tinyint(1) not null default '0', `recur_id` int(11) not null default '0', `currency_id` int(11) not null default '0', `exchange_rate` float(10, 5) not null default '1.00000', `proposal_id` int(20) not null default '0', `send_x_days_before` int(11) not null default '7', `has_sent_notification` int(1) not null default '0', `last_sent` int(11) not null default '0', `next_recur_date` int(11) not null default '0', `last_viewed` int(20) not null default '0', `is_viewable` tinyint(1) not null default '0', `is_archived` tinyint(1) not null default '0', `owner_id` int(255) unsigned not null default '0', `last_status_change` int(255) not null default '0', `status` varchar(255) not null default '', `project_id` int(255) not null default '0', `auto_charge` tinyint(1) not null default '0', primary key (`id`), index unique_id (`unique_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}partial_payments`; -- split -- create table `{DBPREFIX}partial_payments` ( `id` int(11) not null auto_increment, `unique_invoice_id` varchar(10) not null, `amount` float not null, `gateway_surcharge` float not null, `is_percentage` tinyint(1) not null, `due_date` int(11) not null, `notes` text not null, `txn_id` varchar(255) not null default '', `payment_gross` float not null, `item_name` varchar(255) not null, `is_paid` tinyint(1) not null, `payment_date` int(11) not null, `payment_type` varchar(255) not null, `payer_status` varchar(255) not null, `payment_status` varchar(255) not null, `unique_id` varchar(10) not null, `payment_method` varchar(255) not null, `key` int(11) not null, `improved` int(11) not null default 1, `transaction_fee` float not null, primary key (`id`), key `unique_invoice_id` (`unique_invoice_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}permissions`; -- split -- create table `{DBPREFIX}permissions` ( `id` int(11) not null auto_increment, `group_id` int(11) not null, `module` varchar(50) not null, `roles` text, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}projects`; -- split -- create table `{DBPREFIX}projects` ( `id` int(10) unsigned not null auto_increment, `client_id` int(11) not null, `name` varchar(255) not null, `due_date` int(11) not null, `description` text not null, `date_entered` int(11) not null, `date_updated` timestamp on update current_timestamp null default null, `rate` decimal(10, 2) not null default '0.00', `completed` tinyint(4) not null, `currency_id` int(11) not null, `exchange_rate` float(10, 5) not null default '1.00000', `unique_id` varchar(10) not null default '', `is_viewable` tinyint(1) not null, `is_timesheet_viewable` tinyint(1) not null default '0', `projected_hours` float not null default '0', `is_archived` tinyint(1) not null default 0, `owner_id` int(255) unsigned not null default '0', `is_flat_rate` tinyint(1) not null default '0', primary key (`id`), key `client_id` (`client_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_expenses`; -- split -- create table `{DBPREFIX}project_expenses` ( `id` int(10) unsigned not null auto_increment, `project_id` int(10) unsigned not null, `payment_source_id` int(11) default null, `invoice_id` int(11) default null, `invoice_number` varchar(255) default null, `due_date` datetime default null, `name` varchar(255) not null default '', `description` text, `qty` int(10) unsigned not null default '1', `rate` decimal(8, 2) not null, `tax_id` int(10) not null default '0', `supplier_id` int(11) not null default '0', `category_id` int(11) not null default '0', `payment_details` text not null, `owner_id` int(255) unsigned not null default '0', `invoice_item_id` int(11) not null default '0', `receipt` varchar(1024) not null default '', primary key (`id`), key `project_id` (`project_id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}assignments_permissions`; -- split -- create table `{DBPREFIX}assignments_permissions` ( `id` int(10) unsigned not null auto_increment, `user_id` int(255) not null, `client_id` int(255) not null, `item_type` varchar(255) not null default '', `item_id` int(255) not null, `can_all` tinyint(1) not null, `can_create` tinyint(1) not null, `can_read` tinyint(1) not null, `can_update` tinyint(1) not null, `can_delete` tinyint(1) not null, `can_generate_from_project` tinyint(1) not null, `can_send` tinyint(1) not null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_expenses_categories`; -- split -- create table `{DBPREFIX}project_expenses_categories` ( `id` int(10) unsigned not null auto_increment, `parent_id` int(10) unsigned null, `name` varchar(255) not null default '', `description` text, `notes` text, `deleted` tinyint(1) not null default '0', `status` varchar(128) null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_expenses_suppliers`; -- split -- create table `{DBPREFIX}project_expenses_suppliers` ( `id` int(10) unsigned not null auto_increment, `name` varchar(255) not null default '', `description` text, `notes` text, `deleted` tinyint(1) not null default '0', `status` varchar(128) null, primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_tasks`; -- split -- create table `{DBPREFIX}project_tasks` ( `id` int(10) unsigned not null auto_increment, `project_id` int(10) unsigned not null, `milestone_id` int(11) not null default '0', `parent_id` int(10) not null default '0', `name` varchar(255) not null, `rate` decimal(10, 2) not null default '0.00', `hours` decimal(10, 2) not null default '0.0', `notes` text not null, `due_date` int(11) default '0', `completed` tinyint(4) not null, `is_viewable` tinyint(1) not null, `is_timesheet_viewable` tinyint(1) default null, `projected_hours` float not null default '0', `status_id` int(255) default '0', `assigned_user_id` int(10), `date_entered` timestamp null default null, `date_updated` timestamp on update current_timestamp null default null, `owner_id` int(255) unsigned not null default '0', `order` int(11) unsigned not null default '0', `is_flat_rate` tinyint(1) not null default '0', `invoice_item_id` int(11) not null default '0', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_times`; -- split -- create table `{DBPREFIX}project_times` ( `id` int(10) unsigned not null auto_increment, `project_id` int(10) unsigned not null, `task_id` int(10) unsigned default null, `user_id` int(10) unsigned default null, `start_time` varchar(5) not null default '', `end_time` varchar(5) not null default '', `minutes` decimal(16, 8) not null, `date` int(11) default null, `note` text, `invoice_item_id` int(11) not null default '0', `date_updated` timestamp not null default CURRENT_TIMESTAMP on update current_timestamp, primary key (`id`), key `project_id` (`project_id`), key `user_id` (`user_id`), key `date` (`date`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}project_milestones`; -- split -- create table `{DBPREFIX}project_milestones` ( `id` int unsigned not null auto_increment, `name` varchar(255) not null, `description` text, `project_id` int unsigned not null, `assigned_user_id` int unsigned default null, `color` varchar(50) not null, `target_date` int unsigned default null, `is_viewable` tinyint(1) not null, `order` int(11) unsigned not null default '0', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}proposals`; -- split -- create table `{DBPREFIX}proposals` ( `id` int(11) not null auto_increment, `unique_id` varchar(10) not null, `created` int(11) not null, `last_sent` int(11) not null default '0', `last_status_change` int(20) not null default '0', `last_viewed` int(20) not null default '0', `invoice_id` int(11) not null, `project_id` int(11) not null, `client_id` int(11) not null, `title` varchar(255) not null, `status` varchar(255) not null, `proposal_number` varchar(190) not null default '', `client_company` varchar(255) not null default '', `client_address` text, `client_name` varchar(255) not null default '', `is_viewable` tinyint(1) not null, `is_archived` tinyint(1) not null default '0', `owner_id` int(255) unsigned not null default '0', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}proposal_sections`; -- split -- create table `{DBPREFIX}proposal_sections` ( `id` int(11) not null auto_increment, `proposal_id` int(11) not null, `title` varchar(255) not null, `subtitle` varchar(255) not null, `contents` text not null, `key` int(11) not null, `parent_id` int(11) not null, `page_key` int(11) not null, `section_type` varchar(128) not null default '', primary key (`id`) ) engine = InnoDB default charset = utf8; -- split -- drop table if exists `{DBPREFIX}settings`; -- split -- create table `{DBPREFIX}settings` ( `slug` varchar(100) not null default '', `value` longtext, primary key (`slug`) ) engine = InnoDB default charset = utf8; -- split -- insert into `{DBPREFIX}settings` values ('admin_theme', 'pancake'), ('currency', '{CURRENCY}'), ('license_key', '{LICENSE_KEY}'), ('mailing_address', '{MAILING_ADDRESS}'), ('notify_email', '{NOTIFY_EMAIL}'), ('rss_password', '{RSS_PASSWORD}'), ('site_name', '{SITE_NAME}'), ('admin_name', '{FIRST_NAME} {LAST_NAME}'), ('theme', '{THEME}'), ('version', '{VERSION}'), ('latest_version_fetch', '0'), ('auto_update', '0'), ('is_just_installed', '1'), ('ftp_host', ''), ('ftp_user', ''), ('ftp_pass', ''), ('ftp_path', '/'), ('bcc', '0'), ('include_remittance_slip', '1'), ('always_https', '0'), ('remittance_slip', '