CREATE TABLE IF NOT EXISTS `Addresses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `country_id` int(11) DEFAULT NULL,
  `streetNumber` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `buildingName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `streetSuffix` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `streetName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `streetType` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `streetDirection` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
  `addressType_id` int(11) DEFAULT NULL,
  `addressTypeIdentifier` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `localMunicipality` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cityTown` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `governingDistrict` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `postaArea` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `latitude` double DEFAULT NULL,
  `longitude` double DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_ED3BF7B5F92F3E70` (`country_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Appreleaseclousure`
--

CREATE TABLE IF NOT EXISTS `Appreleaseclousure` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `app_id` int(11) DEFAULT NULL,
  `releaseDate` datetime NOT NULL,
  `clousureDate` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_40594D797987212D` (`app_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Apps`
--

CREATE TABLE IF NOT EXISTS `Apps` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `version` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `priorVersion_id` int(11) DEFAULT NULL,
  `active` tinyint(1) DEFAULT NULL,
  `developer_id` int(11) NOT NULL,
  `feeModel_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_B02ED16417FDEC90` (`feeModel_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Appsdevelopers`
--

CREATE TABLE IF NOT EXISTS `Appsdevelopers` (
  `app_id` int(11) NOT NULL,
  `developer_id` int(11) NOT NULL,
  PRIMARY KEY (`app_id`,`developer_id`),
  KEY `IDX_1C48806E7987212D` (`app_id`),
  KEY `IDX_1C48806E64DD9267` (`developer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `Appsenterprises`
--

CREATE TABLE IF NOT EXISTS `Appsenterprises` (
  `enterprise_id` int(11) NOT NULL,
  `app_id` int(11) NOT NULL,
  PRIMARY KEY (`enterprise_id`,`app_id`),
  KEY `IDX_4EADA380A97D1AC3` (`enterprise_id`),
  KEY `IDX_4EADA3807987212D` (`app_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `Appsfeemodels`
--

CREATE TABLE IF NOT EXISTS `Appsfeemodels` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Appsprojects`
--

CREATE TABLE IF NOT EXISTS `Appsprojects` (
  `project_id` int(11) NOT NULL,
  `app_id` int(11) NOT NULL,
  PRIMARY KEY (`project_id`,`app_id`),
  KEY `IDX_28E77946166D1F9C` (`project_id`),
  KEY `IDX_28E779467987212D` (`app_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `BusinessTaxonomyICB`
--

CREATE TABLE IF NOT EXISTS `BusinessTaxonomyICB` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` int(11) NOT NULL,
  `Subsector` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Countries`
--

CREATE TABLE IF NOT EXISTS `Countries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `iso2` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
  `shortName` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `longName` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `iso3` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
  `numcode` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL,
  `unMember` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL,
  `callingCode` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cctld` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `DbSchemeVersion`
--

CREATE TABLE IF NOT EXISTS `DbSchemeVersion` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `updateDate` datetime NOT NULL,
  `updateScript` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `version` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Developers`
--

CREATE TABLE IF NOT EXISTS `Developers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `country_id` int(11) DEFAULT NULL,
  `address_id` int(11) DEFAULT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_44EC4D0AF92F3E70` (`country_id`),
  KEY `IDX_44EC4D0AF5B7AF75` (`address_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Document`
--

CREATE TABLE IF NOT EXISTS `Document` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `folders_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `originalfilename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `author` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `lastmodified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `trash` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_211FE8207FB5B120` (`folders_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

--
-- Bolcant dades de la taula `Document`
--

INSERT INTO `Document` (`id`, `folders_id`, `name`, `originalfilename`, `author`, `lastmodified`, `trash`) VALUES
(1, 1, 'coneix_logo_top (1).gif', 'coneix_logo_top (1).gif', 'jgracia', '2013-08-19 08:21:59', 0);

-- --------------------------------------------------------

--
-- Estructura de la taula `Enterpriseclassification`
--

CREATE TABLE IF NOT EXISTS `Enterpriseclassification` (
  `enterprise_id` int(11) NOT NULL,
  `taxonomy_id` int(11) NOT NULL,
  PRIMARY KEY (`enterprise_id`,`taxonomy_id`),
  KEY `IDX_6E059FBFA97D1AC3` (`enterprise_id`),
  KEY `IDX_6E059FBF9557E6F6` (`taxonomy_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `Enterprises`
--

CREATE TABLE IF NOT EXISTS `Enterprises` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `address_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `nif` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `fiscalName` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `creationDate` datetime NOT NULL,
  `active` tinyint(1) NOT NULL,
  `logoPath` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_42AA20CF5B7AF75` (`address_id`),
  KEY `IDX_42AA20C166D1F9C` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `EnterprisesProjects`
--

CREATE TABLE IF NOT EXISTS `EnterprisesProjects` (
  `project_id` int(11) NOT NULL,
  `enterprise_id` int(11) NOT NULL,
  PRIMARY KEY (`project_id`,`enterprise_id`),
  KEY `IDX_71C9866A166D1F9C` (`project_id`),
  KEY `IDX_71C9866AA97D1AC3` (`enterprise_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `Events`
--

CREATE TABLE IF NOT EXISTS `Events` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `serverTime` datetime NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_542B527CA76ED395` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Folders`
--

CREATE TABLE IF NOT EXISTS `Folders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parentfolder_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `trash` tinyint(1) DEFAULT NULL,
  `lastmodified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `IDX_318AEA93A72150F3` (`parentfolder_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

--
-- Bolcant dades de la taula `Folders`
--

INSERT INTO `Folders` (`id`, `parentfolder_id`, `name`, `trash`, `lastmodified`) VALUES
(1, NULL, 'rootfolder', NULL, '0000-00-00 00:00:00');

-- --------------------------------------------------------

--
-- Estructura de la taula `Groups`
--

CREATE TABLE IF NOT EXISTS `Groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `role` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQ_F7C13C4657698A6A` (`role`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;

--
-- Bolcant dades de la taula `Groups`
--

INSERT INTO `Groups` (`id`, `name`, `role`) VALUES
(1, 'Administrators', 'ROLE_ADMIN'),
(2, 'Developers', 'ROLE_DEVELOPER'),
(3, 'Writers', 'ROLE_WRITER'),
(4, 'Editors', 'ROLE_EDITOR');

-- --------------------------------------------------------

--
-- Estructura de la taula `GroupUser`
--

CREATE TABLE IF NOT EXISTS `GroupUser` (
  `user_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  PRIMARY KEY (`user_id`,`group_id`),
  KEY `IDX_61A90A57A76ED395` (`user_id`),
  KEY `IDX_61A90A57FE54D947` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Bolcant dades de la taula `GroupUser`
--

INSERT INTO `GroupUser` (`user_id`, `group_id`) VALUES
(1, 1),
(1, 2),
(1, 3),
(1, 4),
(2, 1),
(3, 1);

-- --------------------------------------------------------

--
-- Estructura de la taula `Languages`
--

CREATE TABLE IF NOT EXISTS `Languages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Milestone`
--

CREATE TABLE IF NOT EXISTS `Milestone` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `milestonetype_id` int(11) DEFAULT NULL,
  `responsable_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `datetime` datetime DEFAULT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `locked` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_CD5D012134412BC2` (`milestonetype_id`),
  KEY `IDX_CD5D012153C59D72` (`responsable_id`),
  KEY `IDX_CD5D0121166D1F9C` (`project_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=43 ;

--
-- Bolcant dades de la taula `Milestone`
--

INSERT INTO `Milestone` (`id`, `milestonetype_id`, `responsable_id`, `project_id`, `name`, `datetime`, `description`, `locked`) VALUES
(13, NULL, 2, 1, 'sdfsdfdsf', '2013-10-07 00:00:00', 'sdfsdf', 1),
(15, 1, 2, 1, 'Ester', '2013-07-23 00:00:00', 'jjjjjj', NULL),
(36, 1, 3, 1, 'milestone1', '2013-07-23 00:00:00', 'dfgxfgdgfdgdgfdfgd dgfdfgag dfag adfg dfg dfg dfg dfg dfgdfgdfg dfa adf afdg dfg dfg dfg dfg', NULL),
(37, NULL, NULL, 1, 'sdf', '2013-07-24 00:00:00', NULL, NULL),
(42, NULL, NULL, 1, 'mileston lligada a phase i a tasca', '2013-08-31 00:00:00', NULL, NULL);

-- --------------------------------------------------------

--
-- Estructura de la taula `Milestonetype`
--

CREATE TABLE IF NOT EXISTS `Milestonetype` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

--
-- Bolcant dades de la taula `Milestonetype`
--

INSERT INTO `Milestonetype` (`id`, `name`, `description`) VALUES
(1, 'deliverable', ''),
(2, 'meeting', ''),
(3, 'invoicing', '');

-- --------------------------------------------------------

--
-- Estructura de la taula `Neoregistrationtermination`
--

CREATE TABLE IF NOT EXISTS `Neoregistrationtermination` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `registrationDate` datetime DEFAULT NULL,
  `terminationDate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_A784F0FDA76ED395` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Notifications`
--

CREATE TABLE IF NOT EXISTS `Notifications` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `dateTime` datetime NOT NULL,
  `message` longtext COLLATE utf8_unicode_ci NOT NULL,
  `isRead` tinyint(1) DEFAULT NULL,
  `notificationTemplate_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_D37EFB261B7FD535` (`notificationTemplate_id`),
  KEY `IDX_D37EFB26A76ED395` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `NotificationTemplates`
--

CREATE TABLE IF NOT EXISTS `NotificationTemplates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `message` longtext COLLATE utf8_unicode_ci NOT NULL,
  `situation` longtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Phase`
--

CREATE TABLE IF NOT EXISTS `Phase` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `milestone_id` int(11) DEFAULT NULL,
  `status_id` int(11) DEFAULT NULL,
  `responsable_id` int(11) DEFAULT NULL,
  `name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `initials` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `plannedStartDate` date DEFAULT NULL,
  `plannedEndDate` date DEFAULT NULL,
  `realStartDate` date DEFAULT NULL,
  `realEndDate` date DEFAULT NULL,
  `generation` int(11) DEFAULT NULL,
  `numberTasks` int(11) DEFAULT NULL,
  `hourstasks` double DEFAULT NULL,
  `countdatetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_707CF9CF727ACA70` (`parent_id`),
  KEY `IDX_707CF9CF166D1F9C` (`project_id`),
  KEY `IDX_707CF9CF4B3E2EDA` (`milestone_id`),
  KEY `IDX_707CF9CF6BF700BD` (`status_id`),
  KEY `IDX_707CF9CF53C59D72` (`responsable_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=29 ;

--
-- Bolcant dades de la taula `Phase`
--

INSERT INTO `Phase` (`id`, `parent_id`, `project_id`, `milestone_id`, `status_id`, `responsable_id`, `name`, `initials`, `code`, `description`, `plannedStartDate`, `plannedEndDate`, `realStartDate`, `realEndDate`, `generation`, `numberTasks`, `hourstasks`, `countdatetime`) VALUES
(1, NULL, 1, NULL, NULL, NULL, '---', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6, 1, 1, 15, 1, NULL, 'dfsdfaaaa', NULL, NULL, NULL, '2013-07-12', '2013-07-24', '2013-07-18', '2013-07-26', 1, NULL, NULL, NULL),
(8, 1, 1, 36, 1, NULL, 'edu', NULL, NULL, 'dfvg', '2013-07-17', '2013-07-23', '2013-07-11', '2013-07-25', 1, NULL, NULL, NULL),
(9, 1, 1, 15, 1, NULL, 'edsfdfsdsf', NULL, NULL, 'sdfsdf', '2013-07-02', '2013-07-09', '2013-07-06', '2013-07-18', 1, NULL, NULL, NULL),
(10, 9, 1, NULL, 1, NULL, 'news23', NULL, NULL, NULL, '2013-07-17', '2013-07-17', '2013-07-17', '2013-07-17', 2, NULL, NULL, NULL),
(11, 1, 1, NULL, 1, NULL, 'hola', NULL, NULL, NULL, '2013-07-18', '2013-07-18', '2013-07-18', '2013-07-25', 1, NULL, NULL, NULL),
(12, 1, 1, NULL, 1, NULL, 'taaa', NULL, NULL, NULL, NULL, '2013-07-25', '2013-07-18', '2013-07-26', 1, NULL, NULL, NULL),
(13, 1, 1, 36, 1, NULL, 'gantt', NULL, NULL, 'dfvgdfg', '2013-07-19', '2014-04-16', '2013-07-20', '2013-07-26', 1, NULL, NULL, NULL),
(17, 1, 1, NULL, 1, NULL, 'prova1', NULL, NULL, NULL, '2013-07-22', '2013-07-22', '2013-07-22', '2013-07-22', 1, NULL, NULL, NULL),
(18, 1, 1, NULL, 1, NULL, 'nova', NULL, NULL, NULL, '2013-07-10', '2013-07-30', '2013-07-10', '2013-07-24', 1, NULL, NULL, NULL),
(27, 1, 1, 42, 1, NULL, 'eeee', NULL, NULL, NULL, NULL, '2013-07-31', NULL, NULL, 1, NULL, NULL, NULL),
(28, 1, 1, 42, 1, NULL, 'Phase sense dates', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL);

-- --------------------------------------------------------

--
-- Estructura de la taula `Privileges`
--

CREATE TABLE IF NOT EXISTS `Privileges` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `document_id` int(11) DEFAULT NULL,
  `lastmodified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `downloadaction` tinyint(1) DEFAULT NULL,
  `linkaction` tinyint(1) DEFAULT NULL,
  `versionaction` tinyint(1) DEFAULT NULL,
  `renameaction` tinyint(1) DEFAULT NULL,
  `moveaction` tinyint(1) DEFAULT NULL,
  `deleteaction` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_2708FAC2A76ED395` (`user_id`),
  KEY `IDX_2708FAC2C33F7837` (`document_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Project`
--

CREATE TABLE IF NOT EXISTS `Project` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `projectCode` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `longName` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `creationDate` datetime NOT NULL,
  `plannedStartDate` date DEFAULT NULL,
  `plannedEndDate` date DEFAULT NULL,
  `realStartDate` date DEFAULT NULL,
  `realEndDate` date DEFAULT NULL,
  `confidentiality_id` int(11) DEFAULT NULL,
  `department_id` int(11) DEFAULT NULL,
  `location_id` int(11) DEFAULT NULL,
  `budget` double DEFAULT NULL,
  `shared` tinyint(1) DEFAULT NULL,
  `numbertasks` int(11) DEFAULT NULL,
  `hourstasks` double DEFAULT NULL,
  `totalregisteredhours` double DEFAULT NULL,
  `projectStatus_id` int(11) DEFAULT NULL,
  `userCreator_id` int(11) DEFAULT NULL,
  `country_id` int(11) DEFAULT NULL,
  `budgetcurrency` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_E00EE972FA884CA5` (`projectStatus_id`),
  KEY `IDX_E00EE9726303218F` (`userCreator_id`),
  KEY `IDX_E00EE972F92F3E70` (`country_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

--
-- Estructura de la taula `Projects`
--

CREATE TABLE IF NOT EXISTS `Projects` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Projectsnapshot`
--

CREATE TABLE IF NOT EXISTS `Projectsnapshot` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project_id` int(11) DEFAULT NULL,
  `date` datetime DEFAULT NULL,
  `totalregisteredhours` double DEFAULT NULL,
  `hourstasks` double DEFAULT NULL,
  `numbertasks` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_46DEC6B3166D1F9C` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Projectstatus`
--

CREATE TABLE IF NOT EXISTS `Projectstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

--
-- Bolcant dades de la taula `Projectstatus`
--

INSERT INTO `Projectstatus` (`id`, `name`, `description`) VALUES
(1, 'not started', ''),
(2, 'started', ''),
(3, 'finished', '');

-- --------------------------------------------------------

--
-- Estructura de la taula `Projectstatussnapshot`
--

CREATE TABLE IF NOT EXISTS `Projectstatussnapshot` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `projectsnapshot_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `numbertasks` int(11) NOT NULL,
  `taskpercentage` double NOT NULL,
  `hourstasks` double NOT NULL,
  `hourspercentage` double NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_BCDC713DD4B214` (`projectsnapshot_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `RegisteredHours`
--

CREATE TABLE IF NOT EXISTS `RegisteredHours` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `task_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `time` double NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`),
  KEY `IDX_98383513A76ED395` (`user_id`),
  KEY `IDX_983835138DB60186` (`task_id`),
  KEY `IDX_98383513166D1F9C` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `taskmakers`
--

CREATE TABLE IF NOT EXISTS `taskmakers` (
  `task_id` int(11) NOT NULL,
  `users_id` int(11) NOT NULL,
  PRIMARY KEY (`task_id`,`users_id`),
  KEY `IDX_9A58565D8DB60186` (`task_id`),
  KEY `IDX_9A58565D67B3B43D` (`users_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `Taskpriorities`
--

CREATE TABLE IF NOT EXISTS `Taskpriorities` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project_id` int(11) DEFAULT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `numberTasks` int(11) DEFAULT NULL,
  `hourstasks` double DEFAULT NULL,
  `countdatetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_260B5443166D1F9C` (`project_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

--
-- Bolcant dades de la taula `Taskpriorities`
--

INSERT INTO `Taskpriorities` (`id`, `project_id`, `name`, `description`, `numberTasks`, `hourstasks`, `countdatetime`) VALUES
(1, 1, 'normal', NULL, 0, 0, '2013-07-31 17:00:29'),
(2, 1, 'urgent', NULL, 0, 0, '2013-07-31 17:00:29');

-- --------------------------------------------------------

--
-- Estructura de la taula `Tasks`
--

CREATE TABLE IF NOT EXISTS `Tasks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `priority_id` int(11) DEFAULT NULL,
  `type_id` int(11) DEFAULT NULL,
  `currentstatus_id` int(11) DEFAULT NULL,
  `workpackage_id` int(11) DEFAULT NULL,
  `phase_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `milestone_id` int(11) DEFAULT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `link` longtext COLLATE utf8_unicode_ci,
  `plannedhours` double DEFAULT NULL,
  `deviation` double DEFAULT NULL,
  `plannedStartDate` date NOT NULL,
  `plannedEndDate` date NOT NULL,
  `realStartDate` date DEFAULT NULL,
  `realEndDate` date DEFAULT NULL,
  `taskCreationDate` date DEFAULT NULL,
  `userCreator_id` int(11) DEFAULT NULL,
  `taskResponsable_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_91994A93497B19F9` (`priority_id`),
  KEY `IDX_91994A93C54C8C93` (`type_id`),
  KEY `IDX_91994A93D84F3FF7` (`currentstatus_id`),
  KEY `IDX_91994A93DBD8A2B7` (`workpackage_id`),
  KEY `IDX_91994A9399091188` (`phase_id`),
  KEY `IDX_91994A936303218F` (`userCreator_id`),
  KEY `IDX_91994A9374E668D5` (`taskResponsable_id`),
  KEY `IDX_91994A93166D1F9C` (`project_id`),
  KEY `IDX_91994A934B3E2EDA` (`milestone_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=19 ;

--
-- Bolcant dades de la taula `Tasks`
--

INSERT INTO `Tasks` (`id`, `priority_id`, `type_id`, `currentstatus_id`, `workpackage_id`, `phase_id`, `project_id`, `milestone_id`, `name`, `description`, `link`, `plannedhours`, `deviation`, `plannedStartDate`, `plannedEndDate`, `realStartDate`, `realEndDate`, `taskCreationDate`, `userCreator_id`, `taskResponsable_id`) VALUES
(17, NULL, NULL, 3, 11, 8, 1, 36, 'task1234', NULL, NULL, NULL, NULL, '2013-07-25', '2013-07-27', '2013-07-27', '2013-07-30', NULL, 2, 2),
(18, NULL, NULL, 1, 1, 1, 1, NULL, 'edu', NULL, NULL, NULL, NULL, '2013-07-03', '2013-07-24', NULL, NULL, NULL, 2, NULL);

-- --------------------------------------------------------

--
-- Estructura de la taula `Taskstatus`
--

CREATE TABLE IF NOT EXISTS `Taskstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project_id` int(11) DEFAULT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `numberTasks` int(11) DEFAULT NULL,
  `taskpercentage` double DEFAULT NULL,
  `hourstasks` double DEFAULT NULL,
  `hourspercentage` double DEFAULT NULL,
  `countdatetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_79C19170166D1F9C` (`project_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

--
-- Bolcant dades de la taula `Taskstatus`
--

INSERT INTO `Taskstatus` (`id`, `project_id`, `name`, `description`, `numberTasks`, `taskpercentage`, `hourstasks`, `hourspercentage`, `countdatetime`) VALUES
(1, 1, 'not started', NULL, NULL, NULL, NULL, NULL, NULL),
(2, 1, 'started', NULL, NULL, NULL, NULL, NULL, NULL),
(3, 1, 'finished', NULL, NULL, NULL, NULL, NULL, NULL);

-- --------------------------------------------------------

--
-- Estructura de la taula `TaskTypes`
--

CREATE TABLE IF NOT EXISTS `TaskTypes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project_id` int(11) DEFAULT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `initials` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `numberTasks` int(11) DEFAULT NULL,
  `hourstasks` double DEFAULT NULL,
  `countdatetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_3496C0F7166D1F9C` (`project_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ;

--
-- Bolcant dades de la taula `TaskTypes`
--

INSERT INTO `TaskTypes` (`id`, `project_id`, `name`, `initials`, `description`, `numberTasks`, `hourstasks`, `countdatetime`) VALUES
(10, 1, 'tester', 'TS', NULL, 0, 0, '2013-07-31 17:00:29');

-- --------------------------------------------------------

--
-- Estructura de la taula `Telephones`
--

CREATE TABLE IF NOT EXISTS `Telephones` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `telephoneNumber` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `telephoneType_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_49A1D34FA76ED395` (`user_id`),
  KEY `IDX_49A1D34F56270F06` (`telephoneType_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Telephonetypes`
--

CREATE TABLE IF NOT EXISTS `Telephonetypes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `UEnterpriseRegistrationTermination`
--

CREATE TABLE IF NOT EXISTS `UEnterpriseRegistrationTermination` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `registrationDate` datetime DEFAULT NULL,
  `terminationDate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `URelationshipType`
--

CREATE TABLE IF NOT EXISTS `URelationshipType` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Estructura de la taula `Userprojects`
--

CREATE TABLE IF NOT EXISTS `Userprojects` (
  `user_id` int(11) NOT NULL,
  `project_id` int(11) NOT NULL,
  PRIMARY KEY (`user_id`,`project_id`),
  KEY `IDX_68E7972BA76ED395` (`user_id`),
  KEY `IDX_68E7972B166D1F9C` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `Usersenterprises`
--

CREATE TABLE IF NOT EXISTS `Usersenterprises` (
  `enterprise_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`enterprise_id`,`user_id`),
  KEY `IDX_21A9094AA97D1AC3` (`enterprise_id`),
  KEY `IDX_21A9094AA76ED395` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de la taula `Versions`
--

CREATE TABLE IF NOT EXISTS `Versions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `document_id` int(11) DEFAULT NULL,
  `phisicalname` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `version_number` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `uploaddate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `IDX_E0AA2284C33F7837` (`document_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

--
-- Bolcant dades de la taula `Versions`
--

INSERT INTO `Versions` (`id`, `document_id`, `phisicalname`, `version_number`, `uploaddate`) VALUES
(1, 1, 'V1coneix_logo_top (1).gif', '1', '2013-08-19 08:21:59');

-- --------------------------------------------------------

--
-- Estructura de la taula `Workpackage`
--

CREATE TABLE IF NOT EXISTS `Workpackage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `responsable_id` int(11) DEFAULT NULL,
  `name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `initials` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` longtext COLLATE utf8_unicode_ci,
  `generation` int(11) DEFAULT NULL,
  `numberTasks` int(11) DEFAULT NULL,
  `hourstasks` double DEFAULT NULL,
  `countdatetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_A3EC9E3727ACA70` (`parent_id`),
  KEY `IDX_A3EC9E3166D1F9C` (`project_id`),
  KEY `IDX_A3EC9E353C59D72` (`responsable_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=24 ;

--
-- Bolcant dades de la taula `Workpackage`
--

INSERT INTO `Workpackage` (`id`, `parent_id`, `project_id`, `responsable_id`, `name`, `initials`, `code`, `description`, `generation`, `numberTasks`, `hourstasks`, `countdatetime`) VALUES
(1, NULL, 1, NULL, '---', NULL, NULL, NULL, 0, 1, 0, '2013-07-31 17:00:29'),
(11, 1, 1, NULL, 'tester', NULL, NULL, NULL, 1, 1, 0, '2013-07-31 17:00:29'),
(23, 11, 1, NULL, 'widget', NULL, NULL, NULL, 2, 0, 0, '2013-07-31 17:00:29');

--
-- Restriccions per taules bolcades
--

--
-- Restriccions per la taula `Addresses`
--
ALTER TABLE `Addresses`
  ADD CONSTRAINT `FK_ED3BF7B5F92F3E70` FOREIGN KEY (`country_id`) REFERENCES `Countries` (`id`);

--
-- Restriccions per la taula `Appreleaseclousure`
--
ALTER TABLE `Appreleaseclousure`
  ADD CONSTRAINT `FK_40594D797987212D` FOREIGN KEY (`app_id`) REFERENCES `Apps` (`id`);

--
-- Restriccions per la taula `Apps`
--
ALTER TABLE `Apps`
  ADD CONSTRAINT `FK_B02ED16417FDEC90` FOREIGN KEY (`feeModel_id`) REFERENCES `Appsfeemodels` (`id`);

--
-- Restriccions per la taula `Appsdevelopers`
--
ALTER TABLE `Appsdevelopers`
  ADD CONSTRAINT `FK_1C48806E64DD9267` FOREIGN KEY (`developer_id`) REFERENCES `Developers` (`id`),
  ADD CONSTRAINT `FK_1C48806E7987212D` FOREIGN KEY (`app_id`) REFERENCES `Apps` (`id`);

--
-- Restriccions per la taula `Appsenterprises`
--
ALTER TABLE `Appsenterprises`
  ADD CONSTRAINT `FK_4EADA3807987212D` FOREIGN KEY (`app_id`) REFERENCES `Apps` (`id`),
  ADD CONSTRAINT `FK_4EADA380A97D1AC3` FOREIGN KEY (`enterprise_id`) REFERENCES `Enterprises` (`id`);

--
-- Restriccions per la taula `Appsprojects`
--
ALTER TABLE `Appsprojects`
  ADD CONSTRAINT `FK_28E77946166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Projects` (`id`),
  ADD CONSTRAINT `FK_28E779467987212D` FOREIGN KEY (`app_id`) REFERENCES `Apps` (`id`);

--
-- Restriccions per la taula `Developers`
--
ALTER TABLE `Developers`
  ADD CONSTRAINT `FK_44EC4D0AF5B7AF75` FOREIGN KEY (`address_id`) REFERENCES `Addresses` (`id`),
  ADD CONSTRAINT `FK_44EC4D0AF92F3E70` FOREIGN KEY (`country_id`) REFERENCES `Countries` (`id`);

--
-- Restriccions per la taula `Document`
--
ALTER TABLE `Document`
  ADD CONSTRAINT `FK_211FE8207FB5B120` FOREIGN KEY (`folders_id`) REFERENCES `Folders` (`id`);

--
-- Restriccions per la taula `Enterpriseclassification`
--
ALTER TABLE `Enterpriseclassification`
  ADD CONSTRAINT `FK_6E059FBF9557E6F6` FOREIGN KEY (`taxonomy_id`) REFERENCES `BusinessTaxonomyICB` (`id`),
  ADD CONSTRAINT `FK_6E059FBFA97D1AC3` FOREIGN KEY (`enterprise_id`) REFERENCES `Enterprises` (`id`);

--
-- Restriccions per la taula `Enterprises`
--
ALTER TABLE `Enterprises`
  ADD CONSTRAINT `FK_42AA20C166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_42AA20CF5B7AF75` FOREIGN KEY (`address_id`) REFERENCES `Addresses` (`id`);

--
-- Restriccions per la taula `EnterprisesProjects`
--
ALTER TABLE `EnterprisesProjects`
  ADD CONSTRAINT `FK_71C9866A166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Enterprises` (`id`),
  ADD CONSTRAINT `FK_71C9866AA97D1AC3` FOREIGN KEY (`enterprise_id`) REFERENCES `Projects` (`id`);

--
-- Restriccions per la taula `Events`
--
ALTER TABLE `Events`
  ADD CONSTRAINT `FK_542B527CA76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `Folders`
--
ALTER TABLE `Folders`
  ADD CONSTRAINT `FK_318AEA93A72150F3` FOREIGN KEY (`parentfolder_id`) REFERENCES `Folders` (`id`);

--
-- Restriccions per la taula `GroupUser`
--
ALTER TABLE `GroupUser`
  ADD CONSTRAINT `FK_61A90A57A76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_61A90A57FE54D947` FOREIGN KEY (`group_id`) REFERENCES `Groups` (`id`);

--
-- Restriccions per la taula `Milestone`
--
ALTER TABLE `Milestone`
  ADD CONSTRAINT `FK_CD5D0121166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_CD5D012134412BC2` FOREIGN KEY (`milestonetype_id`) REFERENCES `Milestonetype` (`id`),
  ADD CONSTRAINT `FK_CD5D012153C59D72` FOREIGN KEY (`responsable_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `Neoregistrationtermination`
--
ALTER TABLE `Neoregistrationtermination`
  ADD CONSTRAINT `FK_A784F0FDA76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `Notifications`
--
ALTER TABLE `Notifications`
  ADD CONSTRAINT `FK_D37EFB261B7FD535` FOREIGN KEY (`notificationTemplate_id`) REFERENCES `NotificationTemplates` (`id`),
  ADD CONSTRAINT `FK_D37EFB26A76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `Phase`
--
ALTER TABLE `Phase`
  ADD CONSTRAINT `FK_707CF9CF166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_707CF9CF4B3E2EDA` FOREIGN KEY (`milestone_id`) REFERENCES `Milestone` (`id`),
  ADD CONSTRAINT `FK_707CF9CF53C59D72` FOREIGN KEY (`responsable_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_707CF9CF6BF700BD` FOREIGN KEY (`status_id`) REFERENCES `Projectstatus` (`id`),
  ADD CONSTRAINT `FK_707CF9CF727ACA70` FOREIGN KEY (`parent_id`) REFERENCES `Phase` (`id`);

--
-- Restriccions per la taula `Privileges`
--
ALTER TABLE `Privileges`
  ADD CONSTRAINT `FK_2708FAC2C33F7837` FOREIGN KEY (`document_id`) REFERENCES `Document` (`id`),
  ADD CONSTRAINT `FK_2708FAC2A76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `Project`
--
ALTER TABLE `Project`
  ADD CONSTRAINT `FK_E00EE972F92F3E70` FOREIGN KEY (`country_id`) REFERENCES `Countries` (`id`),
  ADD CONSTRAINT `FK_E00EE9726303218F` FOREIGN KEY (`userCreator_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_E00EE972FA884CA5` FOREIGN KEY (`projectStatus_id`) REFERENCES `Projectstatus` (`id`);

--
-- Restriccions per la taula `Projectsnapshot`
--
ALTER TABLE `Projectsnapshot`
  ADD CONSTRAINT `FK_46DEC6B3166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`);

--
-- Restriccions per la taula `Projectstatussnapshot`
--
ALTER TABLE `Projectstatussnapshot`
  ADD CONSTRAINT `FK_BCDC713DD4B214` FOREIGN KEY (`projectsnapshot_id`) REFERENCES `Projectsnapshot` (`id`);

--
-- Restriccions per la taula `RegisteredHours`
--
ALTER TABLE `RegisteredHours`
  ADD CONSTRAINT `FK_98383513166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_983835138DB60186` FOREIGN KEY (`task_id`) REFERENCES `Tasks` (`id`),
  ADD CONSTRAINT `FK_98383513A76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `taskmakers`
--
ALTER TABLE `taskmakers`
  ADD CONSTRAINT `FK_9A58565D67B3B43D` FOREIGN KEY (`users_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_9A58565D8DB60186` FOREIGN KEY (`task_id`) REFERENCES `Tasks` (`id`);

--
-- Restriccions per la taula `Taskpriorities`
--
ALTER TABLE `Taskpriorities`
  ADD CONSTRAINT `FK_260B5443166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`);

--
-- Restriccions per la taula `Tasks`
--
ALTER TABLE `Tasks`
  ADD CONSTRAINT `FK_91994A93166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_91994A93497B19F9` FOREIGN KEY (`priority_id`) REFERENCES `Taskpriorities` (`id`),
  ADD CONSTRAINT `FK_91994A934B3E2EDA` FOREIGN KEY (`milestone_id`) REFERENCES `Milestone` (`id`),
  ADD CONSTRAINT `FK_91994A936303218F` FOREIGN KEY (`userCreator_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_91994A9374E668D5` FOREIGN KEY (`taskResponsable_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_91994A9399091188` FOREIGN KEY (`phase_id`) REFERENCES `Phase` (`id`),
  ADD CONSTRAINT `FK_91994A93C54C8C93` FOREIGN KEY (`type_id`) REFERENCES `TaskTypes` (`id`),
  ADD CONSTRAINT `FK_91994A93D84F3FF7` FOREIGN KEY (`currentstatus_id`) REFERENCES `Taskstatus` (`id`),
  ADD CONSTRAINT `FK_91994A93DBD8A2B7` FOREIGN KEY (`workpackage_id`) REFERENCES `Workpackage` (`id`);

--
-- Restriccions per la taula `Taskstatus`
--
ALTER TABLE `Taskstatus`
  ADD CONSTRAINT `FK_79C19170166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`);

--
-- Restriccions per la taula `TaskTypes`
--
ALTER TABLE `TaskTypes`
  ADD CONSTRAINT `FK_3496C0F7166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`);

--
-- Restriccions per la taula `Telephones`
--
ALTER TABLE `Telephones`
  ADD CONSTRAINT `FK_49A1D34F56270F06` FOREIGN KEY (`telephoneType_id`) REFERENCES `Telephonetypes` (`id`),
  ADD CONSTRAINT `FK_49A1D34FA76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `Userprojects`
--
ALTER TABLE `Userprojects`
  ADD CONSTRAINT `FK_68E7972B166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Projects` (`id`),
  ADD CONSTRAINT `FK_68E7972BA76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `Usersenterprises`
--
ALTER TABLE `Usersenterprises`
  ADD CONSTRAINT `FK_21A9094AA76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_21A9094AA97D1AC3` FOREIGN KEY (`enterprise_id`) REFERENCES `Enterprises` (`id`);

--
-- Restriccions per la taula `Versions`
--
ALTER TABLE `Versions`
  ADD CONSTRAINT `FK_E0AA2284C33F7837` FOREIGN KEY (`document_id`) REFERENCES `Document` (`id`);

--
-- Restriccions per la taula `Workpackage`
--
ALTER TABLE `Workpackage`
  ADD CONSTRAINT `FK_A3EC9E3166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_A3EC9E353C59D72` FOREIGN KEY (`responsable_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_A3EC9E3727ACA70` FOREIGN KEY (`parent_id`) REFERENCES `Workpackage` (`id`);

