+#
+# Structure for table tt_templates.
+# This table keeps templates used in groups.
+#
+CREATE TABLE `tt_templates` (
+ `id` int(11) NOT NULL auto_increment, # template id
+ `group_id` int(11) default NULL, # group id
+ `org_id` int(11) default NULL, # organization id
+ `name` varchar(80) COLLATE utf8mb4_bin NOT NULL, # template name
+ `description` varchar(255) default NULL, # template description
+ `content` text, # template content
+ `created` datetime default NULL, # creation timestamp
+ `created_ip` varchar(45) default NULL, # creator ip
+ `created_by` int(11) default NULL, # creator user_id
+ `modified` datetime default NULL, # modification timestamp
+ `modified_ip` varchar(45) default NULL, # modifier ip
+ `modified_by` int(11) default NULL, # modifier user_id
+ `status` tinyint(4) default 1, # template status
+ PRIMARY KEY (`id`)
+);
+
+
+#
+# Structure for table tt_files.
+# This table keeps file attachment information.
+#
+CREATE TABLE `tt_files` (
+ `id` int(10) unsigned NOT NULL auto_increment, # file id
+ `group_id` int(10) unsigned, # group id
+ `org_id` int(10) unsigned, # organization id
+ `remote_id` bigint(20) unsigned, # file id in storage facility
+ `file_key` varchar(32), # file key
+ `entity_type` varchar(32), # type of entity file is associated with (project, task, etc.)
+ `entity_id` int(10) unsigned, # entity id
+ `file_name` varchar(80) COLLATE utf8mb4_bin NOT NULL, # file name
+ `description` varchar(255) default NULL, # file description
+ `created` datetime default NULL, # creation timestamp
+ `created_ip` varchar(45) default NULL, # creator ip
+ `created_by` int(10) unsigned, # creator user_id
+ `modified` datetime default NULL, # modification timestamp
+ `modified_ip` varchar(45) default NULL, # modifier ip
+ `modified_by` int(10) unsigned, # modifier user_id
+ `status` tinyint(1) default 1, # file status
+ PRIMARY KEY (`id`)
+);
+
+
+#
+# Structure for table tt_work_currencies.
+# This table keeps currencies supported by remote work plugin.
+#
+CREATE TABLE `tt_work_currencies` (
+ `id` int(10) unsigned NOT NULL, # currency id
+ `name` varchar(10) NOT NULL, # currency name (USD, CAD, etc.)
+ PRIMARY KEY (`id`)
+);
+
+# Create an index that guarantees unique work currencies.
+create unique index currency_idx on tt_work_currencies(`name`);
+
+INSERT INTO `tt_work_currencies` (`id`, `name`) VALUES ('1', 'USD'), ('2', 'CAD'), ('3', 'AUD'), ('4', 'EUR'), ('5', 'NZD');
+
+
+#
+# Structure for table tt_work_categories.
+# This table keeps work categories supported by remote work plugin.
+#
+CREATE TABLE `tt_work_categories` (
+ `id` int(10) unsigned NOT NULL, # Category id.
+ `parents` text default NULL, # Comma-separated list of parent ids associated with this category.
+ `name` varchar(64) NOT NULL, # English category name.
+ `name_localized` text default NULL, # Comma-separated list of localized category names in other languages.
+ # Example: es:Codificación,ru:Кодирование.
+ PRIMARY KEY (`id`)
+);
+
+# Insert some default categories. Table content to be updated at run time, though.
+INSERT INTO `tt_work_categories` (`id`, `parents`, `name`, `name_localized`) VALUES ('1', NULL, 'Coding', 'es:Codificación,ru:Кодирование');
+INSERT INTO `tt_work_categories` (`id`, `parents`, `name`, `name_localized`) VALUES ('2', NULL, 'Other', 'es:Otra,ru:Другое');
+INSERT INTO `tt_work_categories` (`id`, `parents`, `name`, `name_localized`) VALUES ('3', '1', 'PHP', NULL);
+INSERT INTO `tt_work_categories` (`id`, `parents`, `name`, `name_localized`) VALUES ('4', '1', 'C/C++', NULL);
+
+