text: CREATE TABLE IF NOT EXISTS `module` ( `module_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `uuid` varchar(36) NOT NULL, `current_major_version` int(11) NOT NULL DEFAULT '0', `current_minor_version` int(11) NOT NULL DEFAULT '0', `current_patch_version` int(11) NOT NULL DEFAULT '0', `enabled` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`module_id`), UNIQUE KEY (`name`), UNIQUE KEY (`uuid`))
  CREATE TABLE IF NOT EXISTS `tracker_user2aggregate_metric_spec` ('. ' `user_id` bigint(20) NOT NULL,'. ' `aggregate_metric_spec_id` bigint(20) NOT NULL,'. ' PRIMARY KEY (`user_id`, `aggregate_metric_spec_id`)'. ')
  CREATE TABLE IF NOT EXISTS `itempolicyuser` ( `item_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `item_user_id` (`item_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `feedpolicyuser` ( `feed_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `feed_user_id` (`feed_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `license` ( `license_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` text NOT NULL, `fulltext` text NOT NULL, PRIMARY KEY (`license_id`))
  CREATE TABLE IF NOT EXISTS `folder` ( `folder_id` bigint(20) NOT NULL AUTO_INCREMENT, `left_indice` bigint(20) NOT NULL, `right_indice` bigint(20) NOT NULL, `parent_id` bigint(20) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `description` text NOT NULL, `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `view` bigint(20) NOT NULL DEFAULT '0', `teaser` varchar(250) DEFAULT '', `privacy_status` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', `date_creation` timestamp, PRIMARY KEY (`folder_id`), KEY `parent_id` (`parent_id`))
  CREATE TABLE IF NOT EXISTS `user` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT, `password` varchar(100) NOT NULL, `firstname` varchar(255) NOT NULL, `company` varchar(255) DEFAULT NULL, `thumbnail` varchar(255) DEFAULT NULL, `lastname` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `privacy` tinyint(4) NOT NULL DEFAULT '0', `admin` tinyint(4) NOT NULL DEFAULT '0', `folder_id` bigint(20) DEFAULT NULL, `creation` timestamp NULL DEFAULT NULL, `publicfolder_id` bigint(20) DEFAULT NULL, `privatefolder_id` bigint(20) DEFAULT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `uuid` varchar(255) DEFAULT '', `city` varchar(100) DEFAULT '', `country` varchar(100) DEFAULT '', `website` varchar(255) DEFAULT '', `biography` varchar(255) DEFAULT '', `dynamichelp` tinyint(4) DEFAULT '1', PRIMARY KEY (`user_id`), KEY `email` (`email`))
  CREATE TABLE IF NOT EXISTS `group` ( `group_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY (`group_id`), KEY (`community_id`))
  CREATE TABLE IF NOT EXISTS `tracker_aggregate_metric` ( `aggregate_metric_id` bigint(20) NOT NULL AUTO_INCREMENT, `aggregate_metric_spec_id` bigint(20) NOT NULL, `submission_id` bigint(20) NOT NULL, `value` double, PRIMARY KEY (`aggregate_metric_id`), KEY (`aggregate_metric_spec_id`), KEY (`submission_id`))
  CREATE TABLE IF NOT EXISTS `pendinguser` ( `pendinguser_id` bigint(20) NOT NULL AUTO_INCREMENT, `auth_key` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(100) NOT NULL, `firstname` varchar(255) NOT NULL, `lastname` varchar(255) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`pendinguser_id`) )
  CREATE TABLE IF NOT EXISTS `assetstore` ( `assetstore_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `path` varchar(512) NOT NULL, `type` tinyint(4) NOT NULL, PRIMARY KEY (`assetstore_id`))
  CREATE TABLE IF NOT EXISTS `thumbnailcreator_itemthumbnail` ( `itemthumbnail_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20), `thumbnail` varchar(255), PRIMARY KEY (`itemthumbnail_id`), KEY (`item_id`))
  CREATE TABLE IF NOT EXISTS `scheduler_job_log` ( `log_id` bigint(20) NOT NULL, `job_id` bigint(20), `date` timestamp, `log` text, PRIMARY KEY (`log_id`) )
  CREATE TABLE IF NOT EXISTS `tracker_scalar` ( `scalar_id` bigint(20) NOT NULL AUTO_INCREMENT, `trend_id` bigint(20) NOT NULL, `value` double, `producer_revision` varchar(255), `submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `user_id` bigint(20) NOT NULL DEFAULT '-1', `submission_id` bigint(20) NOT NULL DEFAULT '-1', `official` tinyint(4) NOT NULL DEFAULT '1', `build_results_url` text NOT NULL, `branch` varchar(255) NOT NULL DEFAULT '', `params` text, `extra_urls` text, PRIMARY KEY (`scalar_id`), KEY (`trend_id`), KEY (`submit_time`), KEY (`user_id`), KEY (`submission_id`), KEY (`branch`))
  CREATE TABLE IF NOT EXISTS `folderpolicyuser` ( `folder_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `folder_id` (`folder_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `oauth_code` ( `code_id` bigint(20) NOT NULL AUTO_INCREMENT, `code` varchar(64) NOT NULL, `scopes` varchar(255) NOT NULL, `user_id` bigint(20) NOT NULL, `client_id` bigint(20) NOT NULL, `creation_date` timestamp, `expiration_date` timestamp, PRIMARY KEY (`code_id`), KEY (`code`))
  CREATE TABLE IF NOT EXISTS `bitstream` ( `bitstream_id` bigint(20) NOT NULL AUTO_INCREMENT, `itemrevision_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL, `mimetype` varchar(30) NOT NULL, `sizebytes` bigint(20) NOT NULL, `checksum` varchar(64) NOT NULL, `path` varchar(512) NOT NULL, `assetstore_id` int(11) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`bitstream_id`), KEY (`itemrevision_id`), KEY (`checksum`))
  SELECT MAX(userapi_id) FROM userapi)+1);
  CREATE TABLE IF NOT EXISTS `uniqueidentifier` ( `uniqueidentifier_id` varchar(255) NOT NULL, `resource_id` bigint(20), `resource_type` tinyint(4), PRIMARY KEY (`uniqueidentifier_id`) )
  CREATE TABLE IF NOT EXISTS `feedpolicyuser` ( `feed_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `feed_id` (`feed_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `item2folder` ( `item_id` bigint(20) NOT NULL, `folder_id` bigint(20) NOT NULL)
  CREATE TABLE IF NOT EXISTS license ( license_id serial PRIMARY KEY, name TEXT NOT NULL DEFAULT '', fulltext TEXT NOT NULL DEFAULT '' )
  SELECT MAX(setting_id) FROM setting)+1);
  UPDATE tracker_scalar set submission_id=LAST_INSERT_ID where submit_time=cur_time
  CREATE TABLE IF NOT EXISTS `itempolicyuser` ( `item_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `item_id` (`item_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `group` ( `group_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY (`group_id`), KEY `community_id` (`community_id`))
  CREATE TABLE IF NOT EXISTS `folder` ( `folder_id` bigint(20) NOT NULL AUTO_INCREMENT, `left_indice` bigint(20) NOT NULL, `right_indice` bigint(20) NOT NULL, `parent_id` bigint(20) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `description` text NOT NULL, `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `view` bigint(20) NOT NULL DEFAULT '0', `teaser` varchar(250) DEFAULT '', `privacy_status` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`folder_id`), KEY `parent_id` (`parent_id`))
  CREATE TABLE IF NOT EXISTS `tracker_user2aggregate_metric_notification` ('. ' `user_id` bigint(20) NOT NULL,'. ' `aggregate_metric_notification_id` bigint(20) NOT NULL,'. ' PRIMARY KEY (`user_id`, `aggregate_metric_notification_id`)'. ')
  CREATE TABLE IF NOT EXISTS `folderpolicyuser` ( `folder_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP(), UNIQUE KEY `folder_id` (`folder_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `tracker_producer` ( `producer_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL, `repository` varchar(255) NOT NULL, `executable_name` varchar(255) NOT NULL, `display_name` varchar(255) NOT NULL, `description` text NOT NULL, `revision_url` text NOT NULL, `histogram_max_x` double, `grid_across_metric_groups` tinyint(4) NOT NULL DEFAULT '0', `histogram_number_of_bins` int(11) NOT NULL DEFAULT '10', `producer_definition` text, PRIMARY KEY (`producer_id`), KEY (`community_id`))
  CREATE TABLE IF NOT EXISTS `assetstore` ( `assetstore_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `path` varchar(512) NOT NULL, `type` tinyint(4) NOT NULL, PRIMARY KEY (`assetstore_id`), KEY (`name`))
  CREATE TABLE IF NOT EXISTS `folderpolicygroup` ( `folder_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP(), UNIQUE KEY `folder_id` (`folder_id`, `group_id`))
  CREATE INDEX activedownload_idx_ip ON activedownload (ip);
  CREATE TABLE IF NOT EXISTS `tracker_trend_threshold` ( `trend_threshold_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `metric_name` varchar(255) NOT NULL, `abbreviation` varchar(255) NOT NULL DEFAULT '', `warning` double, `fail` double, `max` double, PRIMARY KEY (`trend_threshold_id`), KEY (`producer_id`))
  CREATE TABLE IF NOT EXISTS `user2group` ( `user_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, UNIQUE KEY `user_id` (`user_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS `communityinvitation` ( `communityinvitation_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20), `user_id` bigint(20), `group_id` bigint(20), PRIMARY KEY (`communityinvitation_id`), UNIQUE KEY `user_group_id` (`user_id`, `group_id`), KEY (`community_id`))
  SELECT MAX(metadata_id) FROM metadata)+1);
  CREATE TABLE IF NOT EXISTS `tracker_trend` ( `trend_id` bigint(20) NOT NULL AUTO_INCREMENT, `trendgroup_id` bigint(20), `metric_name` varchar(255) NOT NULL, `display_name` varchar(255) NOT NULL, `unit` varchar(255) NOT NULL, `key_metric` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`trend_id`), KEY (`trendgroup_id`))
  CREATE TABLE IF NOT EXISTS `folderpolicygroup` ( `folder_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `folder_group_id` (`folder_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS `api_userapi` ( `userapi_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `apikey` varchar(40) NOT NULL, `application_name` varchar(256) NOT NULL, `token_expiration_time` int(11) NOT NULL, `creation_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`userapi_id`) )
  CREATE TABLE IF NOT EXISTS `user` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT, `firstname` varchar(255) NOT NULL, `company` varchar(255), `thumbnail` varchar(255), `lastname` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `privacy` tinyint(4) NOT NULL DEFAULT '0', `admin` tinyint(4) NOT NULL DEFAULT '0', `folder_id` bigint(20), `creation` timestamp, `view` bigint(20) NOT NULL DEFAULT '0', `uuid` varchar(255) DEFAULT '', `city` varchar(100) DEFAULT '', `country` varchar(100) DEFAULT '', `website` varchar(255) DEFAULT '', `biography` text, `dynamichelp` tinyint(4) DEFAULT '1', `hash_alg` varchar(32) NOT NULL DEFAULT '', `salt` varchar(64) NOT NULL DEFAULT '', PRIMARY KEY (`user_id`), KEY `lastname_firstname` (`lastname`, `firstname`), KEY (`email`), KEY (`folder_id`))
  CREATE TABLE IF NOT EXISTS `item2keyword` ( `item_id` bigint(20) NOT NULL, `keyword_id` bigint(20) NOT NULL, UNIQUE KEY `item_id` (`item_id`, `keyword_id`))
  CREATE TABLE IF NOT EXISTS `community` ( `community_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text NOT NULL, `creation` timestamp NULL DEFAULT NULL, `privacy` tinyint(4) NOT NULL, `folder_id` bigint(20) DEFAULT NULL, `publicfolder_id` bigint(20) DEFAULT NULL, `privatefolder_id` bigint(20) DEFAULT NULL, `admingroup_id` bigint(20) DEFAULT NULL, `moderatorgroup_id` bigint(20) DEFAULT NULL, `membergroup_id` bigint(20) NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `can_join` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', PRIMARY KEY (`community_id`), KEY `name` (`name`))
  CREATE TABLE IF NOT EXISTS `errorlog` ( `errorlog_id` bigint(20) NOT NULL AUTO_INCREMENT, `priority` tinyint(4) NOT NULL, `module` varchar(255) NOT NULL, `message` text NOT NULL, `datetime` timestamp NULL DEFAULT NULL, PRIMARY KEY (`errorlog_id`))
  SELECT MAX(dashboard2folder_id) FROM validation_dashboard2folder)+1);
  CREATE TABLE IF NOT EXISTS `feedpolicyuser` ( `feed_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP(), UNIQUE KEY `feed_id` (`feed_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS thumbnailcreator_itemthumbnail ( `itemthumbnail_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20), `thumbnail` varchar(255), PRIMARY KEY (`itemthumbnail_id`), KEY (`item_id`) )
  CREATE TABLE IF NOT EXISTS `metadata` ( `metadata_id` bigint(20) NOT NULL AUTO_INCREMENT, `metadatatype_id` int(11) NOT NULL, `element` varchar(255) NOT NULL, `qualifier` varchar(255) NOT NULL, `description` varchar(512) NOT NULL, PRIMARY KEY (`metadata_id`), KEY `metadatatype_id` (`metadatatype_id`))
  SELECT MAX(assetstore_id) FROM assetstore)+1);
  CREATE TABLE IF NOT EXISTS `validation_dashboard2folder` ( `dashboard2folder_id` bigint(20) NOT NULL AUTO_INCREMENT, `dashboard_id` bigint(20) NOT NULL, `folder_id` bigint(20) NOT NULL, PRIMARY KEY (`dashboard2folder_id`))
  CREATE TABLE IF NOT EXISTS `newuserinvitation` ( `newuserinvitation_id` bigint(20) NOT NULL AUTO_INCREMENT, `auth_key` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `inviter_id` bigint(20) NOT NULL, `community_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`newuserinvitation_id`), KEY (`email`), KEY (`inviter_id`), KEY (`group_id`))
  CREATE INDEX folder_idx_left_index ON folder (left_index);
  CREATE TABLE IF NOT EXISTS `tracker_scalar2item` ( `scalar_id` bigint(20) NOT NULL, `item_id` bigint(20) NOT NULL, `label` varchar(255) NOT NULL, KEY (`scalar_id`))
  CREATE TABLE IF NOT EXISTS `itempolicygroup` ( `item_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `item_id` (`item_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS `validation_dashboard2scalarresult` ( `dashboard2scalarresult_id` bigint(20) NOT NULL AUTO_INCREMENT, `dashboard_id` bigint(20) NOT NULL, `scalarresult_id` bigint(20) NOT NULL, PRIMARY KEY (`dashboard2scalarresult_id`))
  CREATE TABLE IF NOT EXISTS `activedownload` ( `activedownload_id` bigint(20) NOT NULL AUTO_INCREMENT, `ip` varchar(100) NOT NULL DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_update` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`activedownload_id`), KEY (`ip`))
  CREATE TABLE IF NOT EXISTS `newuserinvitation` ( `newuserinvitation_id` bigint(20) NOT NULL AUTO_INCREMENT, `auth_key` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `inviter_id` bigint(20) NOT NULL, `community_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`newuserinvitation_id`) )
  CREATE TABLE IF NOT EXISTS `@MN@_thing` ( `thing_id` bigint(20) NOT NULL AUTO_INCREMENT, `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`thing_id`))
  INSERT INTO metadata VALUES(1, 0, 'contributor', 'author')
  CREATE TABLE IF NOT EXISTS `itemrevision` ( `itemrevision_id` int(11) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `revision` int(11) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `changes` text NOT NULL, `user_id` int(11) NOT NULL, `license` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', PRIMARY KEY (`itemrevision_id`), UNIQUE KEY `item_id` (`item_id`, `revision`), KEY `user_id` (`user_id`), KEY `date` (`date`))
  CREATE TABLE IF NOT EXISTS `itempolicyuser` ( `item_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP(), UNIQUE KEY `item_id` (`item_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `folderpolicygroup` ( `folder_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `folder_id` (`folder_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS `validation_scalarresult` ( `scalarresult_id` bigint(20) NOT NULL AUTO_INCREMENT, `folder_id` bigint(20) NOT NULL, `item_id` bigint(20) NOT NULL, `value` double, PRIMARY KEY (`scalarresult_id`))
  CREATE TABLE IF NOT EXISTS `ratings_item` ( `rating_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `rating` tinyint(2) NOT NULL, PRIMARY KEY (`rating_id`), KEY (`item_id`), KEY (`user_id`))
  CREATE TABLE IF NOT EXISTS `ldap_user` ( `ldap_user_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `login` varchar(255) NOT NULL, PRIMARY KEY (`ldap_user_id`), KEY (`login`))
  CREATE TABLE IF NOT EXISTS `metadatadocumentvalue` ( `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, KEY `metadata_id` (`metadata_id`), KEY `itemrevision_id` (`itemrevision_id`), KEY `value` (`value`(1000)))
  CREATE TABLE IF NOT EXISTS `itemrevision` ( `itemrevision_id` int(11) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `revision` int(11) NOT NULL, `date` timestamp NOT NULL, `changes` text NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`itemrevision_id`), UNIQUE KEY `item_id` (`item_id`, `revision`), KEY `user_id` (`user_id`), KEY `date` (`date`))
  SELECT MAX(newuserinvitation_id) FROM newuserinvitation)+1);
  CREATE TABLE IF NOT EXISTS `packages_application` ( `application_id` bigint(20) NOT NULL AUTO_INCREMENT, `project_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `description` text NOT NULL, PRIMARY KEY (`application_id`), KEY (`project_id`))
  CREATE TABLE IF NOT EXISTS `itempolicygroup` ( `item_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP(), UNIQUE KEY `item_id` (`item_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS `tracker_trend` ( `trend_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `metric_name` varchar(255) NOT NULL, `display_name` varchar(255) NOT NULL, `unit` varchar(255) NOT NULL, `config_item_id` bigint(20), `test_dataset_id` bigint(20), `truth_dataset_id` bigint(20), `key_metric` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`trend_id`), KEY (`producer_id`))
  CREATE TABLE IF NOT EXISTS pendinguser ( pendinguser_id serial PRIMARY KEY, auth_key character varying(255) NOT NULL, email character varying(255) NOT NULL, password character varying(100) NOT NULL, firstname character varying(255) NOT NULL, lastname character varying(255) NOT NULL, date_creation timestamp without time zone NOT NULL DEFAULT now() )
  CREATE TABLE IF NOT EXISTS `metadatavalue` ( `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, `metadatavalue_id` bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`metadatavalue_id`), KEY `metadata_id` (`metadata_id`, `itemrevision_id`))
  CREATE TABLE IF NOT EXISTS `errorlog` ( `errorlog_id` bigint(20) NOT NULL AUTO_INCREMENT, `priority` tinyint(4) NOT NULL, `module` varchar(255) NOT NULL, `message` text NOT NULL, `datetime` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`errorlog_id`))
  CREATE TABLE IF NOT EXISTS progress ( progress_id serial PRIMARY KEY, message TEXT NOT NULL, current bigint NOT NULL, maximum bigint NOT NULL, date_creation timestamp without time zone NOT NULL DEFAULT now(), last_update timestamp without time zone NOT NULL )
  CREATE TABLE IF NOT EXISTS `communityinvitation` ( `communityinvitation_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20), `user_id` bigint(20), `group_id` bigint(20), PRIMARY KEY (`communityinvitation_id`))
  CREATE TABLE IF NOT EXISTS `tracker_submission2item` ( `submission_id` bigint(20) NOT NULL, `item_id` bigint(20) NOT NULL, `label` varchar(255) NOT NULL, `trendgroup_id` bigint(20) NOT NULL, KEY (`submission_id`), KEY (`item_id`), KEY (`trendgroup_id`))
  CREATE TABLE IF NOT EXISTS `validation_dashboard` ( `dashboard_id` bigint(20) NOT NULL AUTO_INCREMENT, `owner_id` bigint(20) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `description` text NOT NULL, `truthfolder_id` bigint(20), `testingfolder_id` bigint(20), `trainingfolder_id` bigint(20), `min` double, `max` double, `metric_id` bigint(20), PRIMARY KEY (`dashboard_id`))
  CREATE TABLE IF NOT EXISTS `folder` ( `folder_id` bigint(20) NOT NULL AUTO_INCREMENT, `left_index` bigint(20) NOT NULL, `right_index` bigint(20) NOT NULL, `parent_id` bigint(20) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `description` text NOT NULL, `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `view` bigint(20) NOT NULL DEFAULT '0', `teaser` varchar(255) DEFAULT '', `privacy_status` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`folder_id`), KEY (`parent_id`), KEY (`left_index`), KEY (`right_index`))
  CREATE TABLE IF NOT EXISTS `packages_extensioncompatibility` ( `extension_id` bigint(20) NOT NULL, `core_revision` varchar(255) NOT NULL)
  CREATE TABLE IF NOT EXISTS `tracker_scalar` ( `scalar_id` bigint(20) NOT NULL AUTO_INCREMENT, `trend_id` bigint(20) NOT NULL, `value` double, `producer_revision` varchar(255), `submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `user_id` bigint(20) NOT NULL DEFAULT '-1', `submission_id` bigint(20) NOT NULL DEFAULT '-1', `official` tinyint(4) NOT NULL DEFAULT '1', `build_results_url` text NOT NULL, `branch` varchar(255) NOT NULL DEFAULT '', `extra_urls` text, `reproduction_command` text, PRIMARY KEY (`scalar_id`), KEY (`trend_id`), KEY (`submit_time`), KEY (`user_id`), KEY (`submission_id`), KEY (`branch`))
  CREATE TABLE IF NOT EXISTS `community` ( `community_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text NOT NULL, `creation` timestamp NULL DEFAULT NULL, `privacy` tinyint(4) NOT NULL, `folder_id` bigint(20) DEFAULT NULL, `publicfolder_id` bigint(20) DEFAULT NULL, `privatefolder_id` bigint(20) DEFAULT NULL, `admingroup_id` bigint(20) DEFAULT NULL, `moderatorgroup_id` bigint(20) DEFAULT NULL, `membergroup_id` bigint(20) NOT NULL DEFAULT 0, `view` bigint(20) NOT NULL DEFAULT '0', `can_join` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', PRIMARY KEY (`community_id`), KEY `name` (`name`))
  CREATE TABLE IF NOT EXISTS `pvw_instance` ( `instance_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `port` integer unsigned NOT NULL, `pid` integer unsigned NOT NULL, `sid` varchar(127) NOT NULL, `secret` varchar(64) NOT NULL, `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`instance_id`))
  CREATE TABLE IF NOT EXISTS `bitstream` ( `bitstream_id` bigint(20) NOT NULL AUTO_INCREMENT, `itemrevision_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL, `mimetype` varchar(30) NOT NULL, `sizebytes` bigint(20) NOT NULL, `checksum` varchar(64) NOT NULL, `path` varchar(512) NOT NULL, `assetstore_id` int(11) NOT NULL, `date` timestamp NOT NULL, PRIMARY KEY (`bitstream_id`), KEY `itemrevision_id` (`itemrevision_id`))
  CREATE TABLE IF NOT EXISTS `tracker_param` ( `param_id` bigint(20) NOT NULL AUTO_INCREMENT, `scalar_id` bigint(20) NOT NULL, `param_name` varchar(255) NOT NULL, `param_type` enum('text', 'numeric') NOT NULL, `text_value` text, `numeric_value` double, PRIMARY KEY (`param_id`), KEY (`param_name`))
  CREATE TABLE IF NOT EXISTS api_userapi ( userapi_id serial PRIMARY KEY, user_id bigint NOT NULL, apikey character varying(40) NOT NULL, application_name character varying(256) NOT NULL, token_expiration_time integer NOT NULL, creation_date timestamp without time zone )
  CREATE TABLE IF NOT EXISTS `tracker_aggregate_metric_spec` ( `aggregate_metric_spec_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `description` varchar(255) NOT NULL DEFAULT '', `spec` text NOT NULL DEFAULT '', `abbreviation` varchar(255) NOT NULL DEFAULT '', `warning` double, `fail` double, `min` double, `max` double, `lower_is_better` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`aggregate_metric_spec_id`), KEY (`producer_id`))
  CREATE INDEX item2folder_idx_folder_id ON folder (folder_id);
  CREATE TABLE IF NOT EXISTS `item` ( `item_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `description` text NOT NULL, `type` int(11) NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `download` bigint(20) NOT NULL DEFAULT '0', `sizebytes` bigint(20) NOT NULL DEFAULT '0', `privacy_status` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `thumbnail_id` bigint(20), PRIMARY KEY (`item_id`))
  CREATE TABLE IF NOT EXISTS `item2folder` ( `item_id` bigint(20) NOT NULL, `folder_id` bigint(20) NOT NULL, KEY (`item_id`), KEY (`folder_id`))
  CREATE TABLE IF NOT EXISTS `errorlog` ( `errorlog_id` bigint(20) NOT NULL AUTO_INCREMENT, `priority` tinyint(4) NOT NULL, `module` varchar(255) NOT NULL, `message` text NOT NULL, `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`errorlog_id`))
  CREATE TABLE setting ( setting_id serial PRIMARY KEY, name character varying(256) NOT NULL, module character varying(256) NOT NULL, value text NOT NULL )
  CREATE TABLE IF NOT EXISTS `tracker_scalar` ( `scalar_id` bigint(20) NOT NULL AUTO_INCREMENT, `trend_id` bigint(20) NOT NULL, `value` double, `submission_id` bigint(20) NOT NULL, PRIMARY KEY (`scalar_id`), KEY (`trend_id`), KEY (`submission_id`))
  CREATE TABLE IF NOT EXISTS `remoteprocessing_job2item` ( `job_id` bigint(20) NOT NULL, `item_id` bigint(20) NOT NULL, `type` tinyint(4) NOT NULL DEFAULT '0')
  CREATE TABLE IF NOT EXISTS `ldap_user` ( `ldap_user_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `login` varchar(255) NOT NULL, PRIMARY KEY (`ldap_user_id`), KEY (`login`) )
  CREATE TABLE IF NOT EXISTS `feed` ( `feed_id` bigint(20) NOT NULL AUTO_INCREMENT, `date` timestamp NOT NULL, `user_id` bigint(20) NOT NULL, `type` tinyint(4) NOT NULL, `ressource` varchar(255) NOT NULL, PRIMARY KEY (`feed_id`))
  CREATE TABLE IF NOT EXISTS thumbnailcreator_itemthumbnail ( itemthumbnail_id serial PRIMARY KEY, item_id integer, thumbnail character varying(255) )
  CREATE TABLE IF NOT EXISTS `mfa_apitoken` ( `apitoken_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `token_id` bigint(20) NOT NULL, `creation_date` timestamp NOT NULL, PRIMARY KEY (`apitoken_id`))
  CREATE TABLE IF NOT EXISTS `user2group` ( `user_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, UNIQUE KEY `user_group_id` (`user_id`, `group_id`))
  SELECT MAX(activedownload_id) FROM activedownload)+1);
  SELECT MAX(license_id) FROM license)+1);
  CREATE TABLE IF NOT EXISTS `newuserinvitation` ( `newuserinvitation_id` bigint(20) NOT NULL AUTO_INCREMENT, `auth_key` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `inviter_id` bigint(20) NOT NULL, `community_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`newuserinvitation_id`))
  CREATE TABLE IF NOT EXISTS `communityinvitation` ( `communityinvitation_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) DEFAULT NULL, `user_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`communityinvitation_id`))
  CREATE INDEX folder_idx_right_index ON folder (right_index);
  SELECT MAX(scalarresult_id) FROM validation_scalarresult)+1);
  CREATE TABLE IF NOT EXISTS `user` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT, `password` varchar(100) NOT NULL, `firstname` varchar(255) NOT NULL, `company` varchar(255) DEFAULT NULL, `thumbnail` varchar(255) DEFAULT NULL, `lastname` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `privacy` tinyint(4) NOT NULL DEFAULT '0', `admin` tinyint(4) NOT NULL DEFAULT '0', `folder_id` bigint(20) DEFAULT NULL, `creation` timestamp NULL DEFAULT NULL, `publicfolder_id` bigint(20) DEFAULT NULL, `privatefolder_id` bigint(20) DEFAULT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `uuid` varchar(255) DEFAULT '', `city` varchar(100) DEFAULT '', `country` varchar(100) DEFAULT '', `website` varchar(255) DEFAULT '', `biography` varchar(255) DEFAULT '', PRIMARY KEY (`user_id`), KEY `email` (`email`))
  CREATE TABLE IF NOT EXISTS `packages_extension` ( `extension_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `application_id` bigint(20) NOT NULL, `os` varchar(255) NOT NULL, `arch` varchar(255) NOT NULL, `repository_url` varchar(255) NOT NULL, `revision` varchar(255) NOT NULL, `submissiontype` varchar(255) NOT NULL, `packagetype` varchar(255) NOT NULL, `application_revision` varchar(255) NOT NULL, `release` varchar(255) NOT NULL, `icon_url` text NOT NULL, `productname` varchar(255) NOT NULL, `codebase` varchar(255) NOT NULL, `development_status` text NOT NULL, `category` varchar(255) NOT NULL DEFAULT '', `description` text NOT NULL, `enabled` tinyint(1) NOT NULL DEFAULT '1', `homepage` text NOT NULL, `repository_type` varchar(10) NOT NULL DEFAULT '', `screenshots` text NOT NULL, `contributors` text NOT NULL, PRIMARY KEY (`extension_id`), KEY (`application_id`), KEY (`release`), KEY (`category`))
  CREATE TABLE IF NOT EXISTS `password` ( `hash` varchar(128) NOT NULL, PRIMARY KEY (`hash`) )
  SELECT MAX(folder_id) FROM folder)+1);
  CREATE TABLE IF NOT EXISTS `community` ( `community_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text NOT NULL, `creation` timestamp, `privacy` tinyint(4) NOT NULL, `folder_id` bigint(20), `admingroup_id` bigint(20), `moderatorgroup_id` bigint(20), `membergroup_id` bigint(20) NOT NULL DEFAULT '0', `view` bigint(20) NOT NULL DEFAULT '0', `can_join` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', PRIMARY KEY (`community_id`), KEY (`folder_id`), KEY (`name`), KEY (`admingroup_id`), KEY (`moderatorgroup_id`), KEY (`membergroup_id`))
  CREATE TABLE IF NOT EXISTS `tracker_producer` ( `producer_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL, `repository` varchar(255) NOT NULL, `executable_name` varchar(255) NOT NULL, `display_name` varchar(255) NOT NULL, `description` text NOT NULL, PRIMARY KEY (`producer_id`), KEY (`community_id`))
  CREATE TABLE IF NOT EXISTS `metadata` ( `metadata_id` bigint(20) NOT NULL AUTO_INCREMENT, `metadatatype` int(11) DEFAULT '0', `element` varchar(255) NOT NULL, `qualifier` varchar(255) NOT NULL, `description` varchar(512) NOT NULL, PRIMARY KEY (`metadata_id`), KEY `metadatatype_id` (`metadatatype`))
  CREATE TABLE IF NOT EXISTS `metadata` ( `metadata_id` bigint(20) NOT NULL AUTO_INCREMENT, `metadatatype` int(11) DEFAULT '0', `element` varchar(255) NOT NULL, `qualifier` varchar(255) NOT NULL, PRIMARY KEY (`metadata_id`), KEY (`metadatatype`))
  CREATE INDEX folder_idx_parent_id ON folder (parent_id);
  CREATE TABLE IF NOT EXISTS password ( hash character varying(128) NOT NULL, CONSTRAINT password_hash PRIMARY KEY (hash) )
  CREATE TABLE IF NOT EXISTS `item2folder` ( `item_id` bigint(20) NOT NULL, `folder_id` bigint(20) NOT NULL, KEY (`folder_id`))
  CREATE TABLE IF NOT EXISTS `itempolicygroup` ( `item_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `item_group_id` (`item_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS `userapi` ( `userapi_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `apikey` varchar(64) NOT NULL, `application_name` varchar(255) NOT NULL, `token_expiration_time` int(11) NOT NULL, `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`userapi_id`), UNIQUE KEY `user_id_application_name` (`user_id`, `application_name`))
  CREATE TABLE IF NOT EXISTS `tracker_user2aggregate_metric_spec` ( `user_id` bigint(20) NOT NULL, `aggregate_metric_spec_id` bigint(20) NOT NULL, UNIQUE KEY `tracker_user_aggregate_metric_spec_id` (`user_id`, `aggregate_metric_spec_id`))
  CREATE TABLE IF NOT EXISTS `user` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT, `firstname` varchar(255) NOT NULL, `company` varchar(255), `thumbnail` varchar(255), `lastname` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `privacy` tinyint(4) NOT NULL DEFAULT '0', `admin` tinyint(4) NOT NULL DEFAULT '0', `folder_id` bigint(20), `creation` timestamp, `view` bigint(20) NOT NULL DEFAULT '0', `uuid` varchar(255) DEFAULT '', `city` varchar(100) DEFAULT '', `country` varchar(100) DEFAULT '', `website` varchar(255) DEFAULT '', `biography` text, `dynamichelp` tinyint(4) DEFAULT '1', `hash_alg` varchar(32) NOT NULL DEFAULT '', `salt` varchar(64) NOT NULL DEFAULT '', PRIMARY KEY (`user_id`), KEY (`email`))
  SELECT MAX(job_id) FROM remoteprocessing_job)+1);
  SELECT email, password, firstname, lastname FROM eperson');
  CREATE TABLE IF NOT EXISTS `pendinguser` ( `pendinguser_id` bigint(20) NOT NULL AUTO_INCREMENT, `auth_key` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `firstname` varchar(255) NOT NULL, `lastname` varchar(255) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `salt` varchar(64) NOT NULL DEFAULT '', PRIMARY KEY (`pendinguser_id`), KEY `lastname_firstname` (`lastname`, `firstname`), KEY (`email`))
  SELECT MAX(module_id) FROM module)+1);
  CREATE TABLE IF NOT EXISTS `token` ( `token_id` bigint(20) NOT NULL AUTO_INCREMENT, `userapi_id` bigint(20) NOT NULL, `token` varchar(64) NOT NULL, `expiration_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`token_id`), KEY (`userapi_id`))
  CREATE TABLE IF NOT EXISTS `tracker_aggregate_metric_spec` ( `aggregate_metric_spec_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `description` varchar(255) NOT NULL DEFAULT '', `spec` text NOT NULL DEFAULT '', PRIMARY KEY (`aggregate_metric_spec_id`), KEY (`producer_id`))
  CREATE TABLE IF NOT EXISTS `module` ( `module_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `uuid` varchar(36) NOT NULL, `current_major_version` int(11) NOT NULL DEFAULT '0', `current_minor_version` int(11) NOT NULL DEFAULT '0', `current_patch_version` int(11) NOT NULL DEFAULT '0', `enabled` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`module_id`), UNIQUE KEY (`name`), UNIQUE KEY (`uuid`) )
  UPDATE tracker_submission SET producer_revision=cur_producer_revision, user_id=cur_user_id, official=cur_official, build_results_url=cur_build_results_url, branch=cur_branch, extra_urls=cur_extra_urls, reproduction_command=cur_reproduction_command  WHERE submission_id=cur_id
  CREATE TABLE IF NOT EXISTS `user2group` ( `user_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, UNIQUE KEY `group_user_id` (`group_id`, `user_id`))
  CREATE TABLE IF NOT EXISTS `comments_item` ( `comment_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `comment` text NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`comment_id`), KEY (`item_id`), KEY (`user_id`))
  CREATE TABLE uniqueidentifier ( uniqueidentifier_id character varying(512) PRIMARY KEY, resource_type integer, resource_id bigint )
  CREATE TABLE IF NOT EXISTS `itemkeyword` ( `keyword_id` bigint(20) NOT NULL AUTO_INCREMENT, `value` varchar(255) NOT NULL, `relevance` int(11) NOT NULL, PRIMARY KEY (`keyword_id`), UNIQUE KEY `value` (`value`), KEY `relevance` (`relevance`))
  CREATE TABLE IF NOT EXISTS `feed2community` ( `feed_id` bigint(20) NOT NULL, `community_id` bigint(20) NOT NULL, UNIQUE KEY `community_feed_id` (`community_id`, `feed_id`))
  CREATE TABLE IF NOT EXISTS `tracker_submission` ( `submission_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `uuid` varchar(255) NOT NULL DEFAULT '', `submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `producer_revision` varchar(255), `user_id` bigint(20) NOT NULL DEFAULT '-1', `official` tinyint(4) NOT NULL DEFAULT '1', `build_results_url` text NOT NULL, `branch` varchar(255) NOT NULL DEFAULT '', `extra_urls` text, `reproduction_command` text, `document` text, PRIMARY KEY (`submission_id`), UNIQUE KEY (`uuid`), KEY (`user_id`), KEY (`submit_time`), KEY (`branch`))
  CREATE TABLE IF NOT EXISTS `setting` ( `setting_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `module` varchar(255) NOT NULL, `value` text, PRIMARY KEY (`setting_id`), UNIQUE KEY `module_name` (`name`, `module`))
  CREATE TABLE IF NOT EXISTS `item` ( `item_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(250) NOT NULL, `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `description` text NOT NULL, `type` int(11) NOT NULL, `thumbnail` varchar(255) NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `download` bigint(20) NOT NULL DEFAULT '0', `sizebytes` bigint(20) NOT NULL DEFAULT '0', `privacy_status` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`item_id`))
  CREATE TABLE IF NOT EXISTS `tracker_trendgroup` ( `trendgroup_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `config_item_id` bigint(20), `test_dataset_id` bigint(20), `truth_dataset_id` bigint(20), PRIMARY KEY (`trendgroup_id`), KEY (`producer_id`), KEY (`config_item_id`), KEY (`test_dataset_id`), KEY (`truth_dataset_id`))
  CREATE TABLE IF NOT EXISTS `packages_extensiondependency` ( `extension_name` varchar(255) NOT NULL, `extension_dependency` varchar(255) NOT NULL)
  CREATE TABLE IF NOT EXISTS `dicomserver_registration` ( `registration_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, PRIMARY KEY (`registration_id`))
  CREATE TABLE IF NOT EXISTS `tracker_scalar` ( `scalar_id` bigint(20) NOT NULL AUTO_INCREMENT, `trend_id` bigint(20) NOT NULL, `value` double, `producer_revision` varchar(255), `submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `user_id` bigint(20) NOT NULL DEFAULT '-1', `submission_id` bigint(20) NOT NULL DEFAULT '-1', `official` tinyint(4) NOT NULL DEFAULT '1', `build_results_url` text NOT NULL, `branch` varchar(255) NOT NULL DEFAULT '', `extra_urls` text, PRIMARY KEY (`scalar_id`), KEY (`trend_id`), KEY (`submit_time`), KEY (`user_id`), KEY (`submission_id`), KEY (`branch`))
  CREATE TABLE IF NOT EXISTS `password` ( `hash` varchar(128) NOT NULL, PRIMARY KEY (`hash`))
  CREATE TABLE IF NOT EXISTS `setting` ( `setting_id` bigint(20) NOT NULL AUTO_INCREMENT, `module` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `value` text, PRIMARY KEY (`setting_id`))
  CREATE TABLE IF NOT EXISTS `tracker_submission` ( `submission_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `uuid` varchar(255) NOT NULL DEFAULT '', `submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`submission_id`), UNIQUE KEY (`uuid`))
  CREATE TABLE IF NOT EXISTS `tracker_scalar` ( `scalar_id` bigint(20) NOT NULL AUTO_INCREMENT, `trend_id` bigint(20) NOT NULL, `value` double, `producer_revision` varchar(255), `submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`scalar_id`), KEY (`trend_id`), KEY (`submit_time`))
  CREATE TABLE IF NOT EXISTS `progress` ( `progress_id` bigint(20) NOT NULL AUTO_INCREMENT, `message` text NOT NULL, `current` bigint(20) NOT NULL, `maximum` bigint(20) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_update` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`progress_id`))
  CREATE INDEX folder_idx_left_indice ON folder (left_indice);
  CREATE TABLE IF NOT EXISTS `feed2community` ( `feed_id` bigint(20) NOT NULL, `community_id` bigint(20) NOT NULL, UNIQUE KEY `feed_id` (`feed_id`, `community_id`))
  CREATE TABLE IF NOT EXISTS `metadatadocumentvalue` ( `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, `metadatavalue_id` bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`metadatavalue_id`), KEY `metadata_id` (`metadata_id`), KEY `itemrevision_id` (`itemrevision_id`))
  CREATE TABLE IF NOT EXISTS `packages_project` ( `project_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL, `enabled` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`project_id`))
  CREATE TABLE IF NOT EXISTS `token` ( `token_id` bigint(20) NOT NULL AUTO_INCREMENT, `userapi_id` bigint(20) NOT NULL, `token` varchar(64) NOT NULL, `expiration_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`token_id`))
  CREATE TABLE IF NOT EXISTS `metadatadocumentvalue` ( `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, `metadatavalue_id` bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`metadatavalue_id`), KEY `metadata_id` (`metadata_id`), KEY `itemrevision_id` (`itemrevision_id`), KEY `value` (`value`(1000)))
  CREATE INDEX communityagreement_agreement_community_id_idx ON communityagreement_agreement (community_id);
  CREATE INDEX thumbnailcreator_itemthumbnail_item_id ON thumbnailcreator_itemthumbnail (item_id);
  CREATE TABLE IF NOT EXISTS `user` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT, `password` varchar(100) NOT NULL, `firstname` varchar(255) NOT NULL, `company` varchar(255), `thumbnail` varchar(255), `lastname` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `privacy` tinyint NOT NULL DEFAULT 0, `admin` tinyint NOT NULL DEFAULT 0, `folder_id` bigint(20), `creation` timestamp NULL DEFAULT NULL, `publicfolder_id` bigint(20), `privatefolder_id` bigint(20), `view` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`user_id`), KEY `email` (`email`))
  SELECT MAX(dashboard2scalarresult_id) FROM validation_dashboard2scalarresult)+1);
  CREATE TABLE IF NOT EXISTS `item` ( `item_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(250) NOT NULL, `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `description` varchar(20) NOT NULL, `type` int(11) NOT NULL, `thumbnail` varchar(255) NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `download` bigint(20) NOT NULL DEFAULT '0', `sizebytes` bigint(20) NOT NULL DEFAULT '0', `privacy_status` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`item_id`))
  CREATE TABLE IF NOT EXISTS `item` ( `item_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `description` text NOT NULL, `type` int(11) NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `download` bigint(20) NOT NULL DEFAULT '0', `sizebytes` bigint(20) NOT NULL DEFAULT '0', `privacy_status` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `thumbnail_id` bigint(20), PRIMARY KEY (`item_id`), KEY (`name`), KEY (`thumbnail_id`))
  CREATE TABLE IF NOT EXISTS `api_token` ( `token_id` bigint(20) NOT NULL AUTO_INCREMENT, `userapi_id` bigint(20) NOT NULL, `token` varchar(40) NOT NULL, `expiration_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`token_id`) )
  CREATE TABLE IF NOT EXISTS `community` ( `community_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text NOT NULL, `creation` timestamp NULL, `privacy` tinyint(4) NOT NULL, `folder_id` bigint(20) NOT NULL, `publicfolder_id` bigint(20) NOT NULL, `privatefolder_id` bigint(20) NOT NULL, `admingroup_id` bigint(20) NOT NULL, `moderatorgroup_id` bigint(20) NOT NULL, `membergroup_id` bigint(20) NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`community_id`), KEY `name` (`name`))
  SELECT MAX(community_id) FROM community)+1);
  CREATE TABLE IF NOT EXISTS `metadatavalue` ( `metadatavalue_id` bigint(20) NOT NULL AUTO_INCREMENT, `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, PRIMARY KEY (`metadatavalue_id`), KEY (`itemrevision_id`))
  CREATE TABLE IF NOT EXISTS `communityinvitation` ( `communityinvitation_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20), `user_id` bigint(20), PRIMARY KEY (`communityinvitation_id`) )
  SELECT MAX(metadatavalue_id) FROM metadatavalue)+1);
  SELECT MAX(progress_id) FROM progress)+1);
  CREATE TABLE IF NOT EXISTS `feed` ( `feed_id` bigint(20) NOT NULL AUTO_INCREMENT, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_id` bigint(20) NOT NULL, `type` int(11) NOT NULL, `ressource` varchar(255) NOT NULL, PRIMARY KEY (`feed_id`))
  CREATE TABLE IF NOT EXISTS `tracker_trend` ( `trend_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `metric_name` varchar(255) NOT NULL, `display_name` varchar(255) NOT NULL, `unit` varchar(255) NOT NULL, `config_item_id` bigint(20), `test_dataset_id` bigint(20), `truth_dataset_id` bigint(20), PRIMARY KEY (`trend_id`), KEY (`producer_id`))
  CREATE TABLE IF NOT EXISTS `bitstream` ( `bitstream_id` bigint(20) NOT NULL AUTO_INCREMENT, `itemrevision_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL, `mimetype` varchar(30) NOT NULL, `sizebytes` bigint(20) NOT NULL, `checksum` varchar(64) NOT NULL, `path` varchar(512) NOT NULL, `assetstore_id` int(11) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`bitstream_id`), KEY (`itemrevision_id`), KEY (`name`), KEY (`checksum`), KEY (`assetstore_id`))
  UPDATE tracker_trend SET trendgroup_id=LAST_INSERT_ID WHERE producer_id=cur_producer_id
  CREATE TABLE IF NOT EXISTS `community` ( `community_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text NOT NULL, `creation` timestamp, `privacy` tinyint(4) NOT NULL, `folder_id` bigint(20), `admingroup_id` bigint(20), `moderatorgroup_id` bigint(20), `membergroup_id` bigint(20) NOT NULL DEFAULT '0', `view` bigint(20) NOT NULL DEFAULT '0', `can_join` int(11) DEFAULT '0', `uuid` varchar(255) DEFAULT '', PRIMARY KEY (`community_id`), KEY (`name`))
  CREATE TABLE IF NOT EXISTS `tracker_trend_threshold` ( `trend_threshold_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `metric_name` varchar(255) NOT NULL, `abbreviation` varchar(255) NOT NULL DEFAULT '', `warning` double, `fail` double, `min` double, `max` double, `lower_is_better` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`trend_threshold_id`), KEY (`producer_id`))
  SELECT MAX(group_id) FROM \"group\")+1);
  CREATE TABLE IF NOT EXISTS `feedpolicygroup` ( `feed_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP(), UNIQUE KEY `feed_id` (`feed_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS newuserinvitation ( newuserinvitation_id serial PRIMARY KEY, auth_key character varying(255) NOT NULL, email character varying(255) NOT NULL, inviter_id bigint NOT NULL, community_id bigint NOT NULL, group_id bigint NOT NULL, date_creation timestamp without time zone NOT NULL DEFAULT now() )
  CREATE TABLE IF NOT EXISTS `setting` ( `setting_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `module` varchar(255) NOT NULL, `value` text NULL DEFAULT NULL , PRIMARY KEY (`setting_id`) )
  CREATE TABLE IF NOT EXISTS `tracker_trendgroup` ( `trendgroup_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `config_item_id` bigint(20), `test_dataset_id` bigint(20), `truth_dataset_id` bigint(20), PRIMARY KEY (`trendgroup_id`), KEY (`producer_id`), KEY (`config_item_id`), KEY (`test_dataset_id`), KEY (`truth_dataset_id`))
  SELECT MAX(dashboard_id) FROM validation_dashboard)+1);
  CREATE INDEX ldap_user_login_idx ON ldap_user (login);
  CREATE TABLE IF NOT EXISTS `license` ( `license_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` TEXT NOT NULL, `fulltext` TEXT NOT NULL, PRIMARY KEY (`license_id`) )
  CREATE TABLE IF NOT EXISTS `tracker_aggregate_metric` ('. ' `aggregate_metric_id` bigint(20) NOT NULL AUTO_INCREMENT,'. ' `aggregate_metric_spec_id` bigint(20) NOT NULL,'. ' `submission_id` bigint(20) NOT NULL,'. ' `value` double,'. ' PRIMARY KEY (`aggregate_metric_id`),'. ' KEY (`aggregate_metric_spec_id`),'. ' KEY (`submission_id`)'. ')
  CREATE TABLE IF NOT EXISTS `folderpolicyuser` ( `folder_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `folder_user_id` (`folder_id`, `user_id`))
  SELECT scalar_id, params FROM tracker_scalar WHERE params IS NOT NULL;');
  CREATE TABLE IF NOT EXISTS `tracker_aggregate_metric_notification` ( `aggregate_metric_notification_id` bigint(20) NOT NULL AUTO_INCREMENT, `aggregate_metric_spec_id` bigint(20) NOT NULL, `branch` varchar(255) NOT NULL DEFAULT '', `value` double, `comparison` varchar(2) NOT NULL DEFAULT '', PRIMARY KEY (`aggregate_metric_notification_id`), KEY (`aggregate_metric_spec_id`), KEY (`branch`))
  CREATE TABLE IF NOT EXISTS `tracker_param` ( `param_id` bigint(20) NOT NULL AUTO_INCREMENT, `scalar_id` bigint(20) NOT NULL, `param_name` varchar(255) NOT NULL, `param_type` enum('text', 'numeric') NOT NULL, `text_value` text, `numeric_value` double, PRIMARY KEY (`param_id`), KEY (`param_name`) )
  CREATE TABLE IF NOT EXISTS `sizequota_folderquota` ( `folderquota_id` bigint(20) NOT NULL AUTO_INCREMENT, `folder_id` bigint(20) NOT NULL, `quota` varchar(50) NOT NULL, PRIMARY KEY (`folderquota_id`), KEY (`folder_id`))
  CREATE TABLE IF NOT EXISTS `tracker_submission2item` ( `submission_id` bigint(20) NOT NULL, `item_id` bigint(20) NOT NULL, `label` varchar(255) NOT NULL, `trendgroup_id` bigint(20) NOT NULL, KEY (`submission_id`), KEY (`item_id`), KEY (`trendgroup_id`))
  CREATE TABLE IF NOT EXISTS `mfa_otpdevice` ( `otpdevice_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `secret` varchar(255) NOT NULL, `algorithm` varchar(255) NOT NULL, `counter` varchar(255) NOT NULL DEFAULT '', `length` int(11) NOT NULL, PRIMARY KEY (`otpdevice_id`))
  CREATE TABLE IF NOT EXISTS `pendinguser` ( `pendinguser_id` bigint(20) NOT NULL AUTO_INCREMENT, `auth_key` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `firstname` varchar(255) NOT NULL, `lastname` varchar(255) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `salt` varchar(64) NOT NULL DEFAULT '', PRIMARY KEY (`pendinguser_id`))
  CREATE TABLE IF NOT EXISTS `itemrevision` ( `itemrevision_id` int(11) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `revision` int(11) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `changes` text NOT NULL, `user_id` int(11) NOT NULL, `uuid` varchar(255) DEFAULT '', `license_id` bigint(20), PRIMARY KEY (`itemrevision_id`), UNIQUE KEY `item_revision_id` (`item_id`, `revision`), KEY (`user_id`), KEY (`date`))
  CREATE TABLE IF NOT EXISTS `activedownload` ( `activedownload_id` bigint(20) NOT NULL AUTO_INCREMENT, `ip` varchar(100) NOT NULL DEFAULT '', `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_update` timestamp NOT NULL, PRIMARY KEY (`activedownload_id`), KEY (`ip`) )
  CREATE TABLE IF NOT EXISTS `feed` ( `feed_id` bigint(20) NOT NULL AUTO_INCREMENT, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `user_id` bigint(20) NOT NULL, `type` tinyint(4) NOT NULL, `resource` varchar(255) NOT NULL, PRIMARY KEY (`feed_id`), KEY (`user_id`))
  CREATE TABLE IF NOT EXISTS `remoteprocessing_job` ( `job_id` bigint(20) NOT NULL AUTO_INCREMENT, `os` varchar(512) NOT NULL, `condition` varchar(512) NOT NULL DEFAULT '', `script` text, `params` text, `status` tinyint(4) NOT NULL DEFAULT '0', `expiration_date` timestamp, `creation_date` timestamp, `start_date` timestamp, `creator_id` bigint(20), `name` varchar(512), PRIMARY KEY (`job_id`))
  CREATE TABLE IF NOT EXISTS `tracker_param` ( `param_id` bigint(20) NOT NULL AUTO_INCREMENT, `submission_id` bigint(20) NOT NULL, `param_name` varchar(255) NOT NULL, `param_type` enum('text', 'numeric') NOT NULL, `text_value` text, `numeric_value` double, PRIMARY KEY (`param_id`), KEY (`submission_id`), KEY (`param_name`))
  CREATE TABLE IF NOT EXISTS api_token ( token_id serial PRIMARY KEY, userapi_id bigint NOT NULL, token character varying(40) NOT NULL, expiration_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP )
  CREATE TABLE IF NOT EXISTS `feedpolicygroup` ( `feed_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `feed_id` (`feed_id`, `group_id`))
  SELECT MAX(itemrevision_id) FROM itemrevision)+1);
  CREATE TABLE IF NOT EXISTS `tracker_aggregate_metric_spec` ( `aggregate_metric_spec_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `branch` varchar(255) NOT NULL DEFAULT '', `name` varchar(255) NOT NULL DEFAULT '', `description` varchar(255) NOT NULL DEFAULT '', `spec` text NOT NULL DEFAULT '', `value` double, `comparison` varchar(2) NOT NULL DEFAULT '', PRIMARY KEY (`aggregate_metric_spec_id`), KEY (`producer_id`), KEY (`branch`))
  SELECT MAX(communityinvitation_id) FROM communityinvitation)+1);
  CREATE TABLE IF NOT EXISTS `progress` ( `progress_id` bigint(20) NOT NULL AUTO_INCREMENT, `message` TEXT NOT NULL, `current` bigint(20) NOT NULL, `maximum` bigint(20) NOT NULL, `date_creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_update` timestamp NOT NULL, PRIMARY KEY (`progress_id`) )
  CREATE TABLE IF NOT EXISTS `landingpage_text` ( `landingpage_id` bigint(20) NOT NULL AUTO_INCREMENT, `text` text, PRIMARY KEY (`landingpage_id`))
  CREATE TABLE IF NOT EXISTS `remoteprocessing_job` ( `job_id` bigint(20) NOT NULL AUTO_INCREMENT, `os` varchar(512) NOT NULL, `condition` varchar(512) NOT NULL DEFAULT '', `script` text, `params` text, `status` tinyint(4) NOT NULL DEFAULT '0', `expiration_date` timestamp, `creation_date` timestamp, `start_date` timestamp, PRIMARY KEY (`job_id`))
  SELECT MAX(token_id) FROM token)+1);
  CREATE INDEX item2folder_idx_folder_id ON item2folder (folder_id);
  CREATE TABLE IF NOT EXISTS `scheduler_job_log` ( `log_id` bigint(20) NOT NULL AUTO_INCREMENT, `job_id` bigint(20), `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `log` text, PRIMARY KEY (`log_id`))
  CREATE TABLE IF NOT EXISTS `metadatavalue` ( `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, `metadatavalue_id` bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`metadatavalue_id`), KEY `metadata_id` (`metadata_id`, `itemrevision_id`), KEY `value` (`value`(1000)))
  CREATE INDEX folder_idx_right_indice ON folder (right_indice);
  CREATE TABLE IF NOT EXISTS `tracker_submissionparam` ( `param_id` bigint(20) NOT NULL AUTO_INCREMENT, `submission_id` bigint(20) NOT NULL, `param_name` varchar(255) NOT NULL, `param_type` enum('text', 'numeric') NOT NULL, `text_value` text, `numeric_value` double, PRIMARY KEY (`param_id`), KEY (`submission_id`), KEY (`param_name`))
  CREATE TABLE IF NOT EXISTS `bitstream` ( `bitstream_id` bigint(20) NOT NULL AUTO_INCREMENT, `itemrevision_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL, `mimetype` varchar(30) NOT NULL, `sizebytes` bigint(20) NOT NULL, `checksum` varchar(64) NOT NULL, `path` varchar(512) NOT NULL, `assetstore_id` int(11) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`bitstream_id`), KEY `itemrevision_id` (`itemrevision_id`))
  CREATE TABLE IF NOT EXISTS `item` ( `item_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(250) NOT NULL, `date` timestamp NOT NULL, `description` varchar(20) NOT NULL, `type` int(11) NOT NULL, `thumbnail` varchar(255) NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', `download` bigint(20) NOT NULL DEFAULT '0', `sizebytes` BIGINT( 20 ) NOT NULL DEFAULT '0', PRIMARY KEY (`item_id`))
  CREATE INDEX bitstream_idx_checksum ON bitstream (checksum);
  CREATE TABLE IF NOT EXISTS `metadatavalue` ( `metadatavalue_id` bigint(20) NOT NULL AUTO_INCREMENT, `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, PRIMARY KEY (`metadatavalue_id`), KEY `metadata_itemrevision_id` (`metadata_id`, `itemrevision_id`))
  CREATE TABLE IF NOT EXISTS `googleauth_user` ( `googleauth_user_id` bigint(20) NOT NULL AUTO_INCREMENT, `google_person_id` varchar(255) NOT NULL, `user_id` bigint(20) NOT NULL, PRIMARY KEY (`googleauth_user_id`), KEY `google_person_id` (`google_person_id`), KEY `user_id` (`user_id`))
  CREATE TABLE IF NOT EXISTS `packages_package` ( `package_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `application_id` bigint(20) NOT NULL, `os` varchar(256) NOT NULL, `arch` varchar(256) NOT NULL, `revision` varchar(256) NOT NULL, `submissiontype` varchar(256) NOT NULL, `packagetype` varchar(256) NOT NULL, `productname` varchar(255) NOT NULL DEFAULT '', `codebase` varchar(255) NOT NULL DEFAULT '', `checkoutdate` timestamp NULL DEFAULT NULL, `release` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`package_id`), KEY (`application_id`), KEY (`release`))
  CREATE TABLE IF NOT EXISTS `oauth_token` ( `token_id` bigint(20) NOT NULL AUTO_INCREMENT, `client_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `token` varchar(64) NOT NULL, `scopes` varchar(255) NOT NULL, `type` tinyint(4) NOT NULL, `creation_date` timestamp, `expiration_date` timestamp, PRIMARY KEY (`token_id`), KEY (`token`), KEY (`user_id`))
  CREATE TABLE IF NOT EXISTS activedownload ( activedownload_id serial PRIMARY KEY, ip character varying(100) NOT NULL DEFAULT '', date_creation timestamp without time zone NOT NULL DEFAULT now(), last_update timestamp without time zone NOT NULL)
  CREATE TABLE IF NOT EXISTS `tracker_threshold_notification` ( `threshold_id` bigint(20) NOT NULL AUTO_INCREMENT, `trend_id` bigint(20) NOT NULL, `value` double, `comparison` varchar(2), `action` varchar(80) NOT NULL, `recipient_id` bigint(20) NOT NULL, PRIMARY KEY (`threshold_id`), KEY (`trend_id`))
  CREATE TABLE IF NOT EXISTS `tracker_user2aggregate_metric_notification` ( `user_id` bigint(20) NOT NULL, `aggregate_metric_notification_id` bigint(20) NOT NULL, PRIMARY KEY (`user_id`, `aggregate_metric_notification_id`))
  CREATE TABLE IF NOT EXISTS `tracker_submission` ( `submission_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `uuid` varchar(255) NOT NULL DEFAULT '', `submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `producer_revision` varchar(255), `user_id` bigint(20) NOT NULL DEFAULT '-1', `official` tinyint(4) NOT NULL DEFAULT '1', `build_results_url` text NOT NULL, `branch` varchar(255) NOT NULL DEFAULT '', `extra_urls` text, `reproduction_command` text, PRIMARY KEY (`submission_id`), UNIQUE KEY (`uuid`), KEY (`user_id`), KEY (`submit_time`), KEY (`branch`))
  CREATE TABLE IF NOT EXISTS `tracker_aggregate_metric_spec` ( `aggregate_metric_spec_id` bigint(20) NOT NULL AUTO_INCREMENT, `producer_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `description` varchar(255) NOT NULL DEFAULT '', `spec` text NOT NULL DEFAULT '', `abbreviation` varchar(255) NOT NULL DEFAULT '', `warning` double, `fail` double, `max` double, PRIMARY KEY (`aggregate_metric_spec_id`), KEY (`producer_id`))
  CREATE TABLE IF NOT EXISTS `feedpolicygroup` ( `feed_id` bigint(20) NOT NULL, `group_id` bigint(20) NOT NULL, `policy` tinyint(4) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `feed_group_id` (`feed_id`, `group_id`))
  CREATE TABLE IF NOT EXISTS `communityagreement_agreement` ( `agreement_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL REFERENCES `community` (`community_id`), `agreement` text NOT NULL, PRIMARY KEY (`agreement_id`), KEY (`community_id`))
  CREATE TABLE IF NOT EXISTS ldap_user ( ldap_user_id serial PRIMARY KEY, user_id bigint NOT NULL, login character varying(255) NOT NULL )
  CREATE TABLE IF NOT EXISTS `scheduler_job` ( `job_id` bigint(20) NOT NULL AUTO_INCREMENT, `task` varchar(512) NOT NULL, `run_only_once` tinyint(4) NOT NULL, `fire_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `time_last_fired` timestamp, `time_interval` bigint(20), `priority` tinyint(4), `status` tinyint(4), `params` text, `creator_id` bigint(20), PRIMARY KEY (`job_id`))
  CREATE TABLE IF NOT EXISTS `tracker_producer` ( `producer_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL, `repository` varchar(255) NOT NULL, `executable_name` varchar(255) NOT NULL, `display_name` varchar(255) NOT NULL, `description` text NOT NULL, `revision_url` text NOT NULL, `histogram_max_x` double, PRIMARY KEY (`producer_id`), KEY (`community_id`))
  CREATE TABLE IF NOT EXISTS `thumbnailcreator_itemthumbnail` ( `itemthumbnail_id` bigint(20) NOT NULL AUTO_INCREMENT, `item_id` bigint(20), `thumbnail_id` bigint(20), PRIMARY KEY (`itemthumbnail_id`), KEY (`item_id`))
  CREATE TABLE IF NOT EXISTS `folder` ( `folder_id` bigint(20) NOT NULL AUTO_INCREMENT, `left_indice` bigint(20) NOT NULL, `right_indice` bigint(20) NOT NULL, `parent_id` bigint(20) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `description` text NOT NULL, `date` timestamp NOT NULL, `view` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`folder_id`), KEY `parent_id` (`parent_id`))
  CREATE TABLE IF NOT EXISTS `feed2community` ( `feed_id` bigint(20) NOT NULL, `community_id` bigint(20) NOT NULL, UNIQUE KEY `feed_community_id` (`feed_id`, `community_id`))
  CREATE TABLE IF NOT EXISTS `tracker_user2aggregate_metric_spec` ( `user_id` bigint(20) NOT NULL, `aggregate_metric_spec_id` bigint(20) NOT NULL, PRIMARY KEY (`user_id`, `aggregate_metric_spec_id`))
  SELECT MAX(item_id) FROM item)+1);
  SELECT MAX(bitstream_id) FROM bitstream)+1);
  CREATE TABLE IF NOT EXISTS `setting` ( `setting_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `module` varchar(255) NOT NULL, `value` text, PRIMARY KEY (`setting_id`))
  CREATE TABLE IF NOT EXISTS `tracker_producer` ( `producer_id` bigint(20) NOT NULL AUTO_INCREMENT, `community_id` bigint(20) NOT NULL, `repository` varchar(255) NOT NULL, `executable_name` varchar(255) NOT NULL, `display_name` varchar(255) NOT NULL, `description` text NOT NULL, `revision_url` text NOT NULL, PRIMARY KEY (`producer_id`), KEY (`community_id`))
  CREATE TABLE IF NOT EXISTS `metadatatype` ( `metadatatype_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`metadatatype_id`))
  SELECT MAX(user_id) FROM \"user\")+1);
  CREATE TABLE IF NOT EXISTS `userapi` ( `userapi_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `apikey` varchar(64) NOT NULL, `application_name` varchar(255) NOT NULL, `token_expiration_time` int(11) NOT NULL, `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`userapi_id`))
  CREATE TABLE IF NOT EXISTS `metadatavalue` ( `metadata_id` bigint(20) NOT NULL, `itemrevision_id` bigint(20) NOT NULL, `value` varchar(1024) NOT NULL, KEY `metadata_id` (`metadata_id`, `itemrevision_id`), KEY `value` (`value`(1000)))
  CREATE TABLE IF NOT EXISTS `itemrevision` ( `itemrevision_id` int(11) NOT NULL AUTO_INCREMENT, `item_id` bigint(20) NOT NULL, `revision` int(11) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `changes` text NOT NULL, `user_id` int(11) NOT NULL, `uuid` varchar(255) DEFAULT '', `license_id` bigint(20), PRIMARY KEY (`itemrevision_id`), UNIQUE KEY `item_revision_id` (`item_id`, `revision`), KEY (`user_id`), KEY (`date`), KEY (`license_id`))
  CREATE TABLE communityinvitation ( communityinvitation_id serial PRIMARY KEY, community_id bigint, user_id bigint )
  CREATE TABLE IF NOT EXISTS `feed` ( `feed_id` bigint(20) NOT NULL AUTO_INCREMENT, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `user_id` bigint(20) NOT NULL, `type` tinyint(4) NOT NULL, `resource` varchar(255) NOT NULL, PRIMARY KEY (`feed_id`))
  CREATE TABLE IF NOT EXISTS `oauth_client` ( `client_id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '', `secret` varchar(64) NOT NULL, `owner_id` bigint(20) NOT NULL, `creation_date` timestamp, PRIMARY KEY (`client_id`), KEY (`owner_id`))
  SELECT MAX(feed_id) FROM feed)+1);
  