-- phpMyAdmin SQL Dump
-- version 3.4.11.1deb2
-- http://www.phpmyadmin.net
--
-- Servidor: 10.0.0.10:3306
-- Temps de generació: 09-05-2014 a les 13:36:53
-- Versió del servidor: 5.5.35
-- Versió de PHP: 5.4.4-14+deb7u8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Base de dades: `IPColaborainstance`
--

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

--
-- Estructura de la taula `Addresses`
--

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 `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 `Bill`
--

CREATE TABLE IF NOT EXISTS `Bill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `targetenterprise_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `paymethod_id` int(11) DEFAULT NULL,
  `billstatus_id` int(11) DEFAULT NULL,
  `coin_id` int(11) DEFAULT NULL,
  `billnumber` double NOT NULL,
  `emissiondate` datetime NOT NULL,
  `expirationdate` datetime NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `billtotal` double DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_DA13B6DD1374AB3B` (`targetenterprise_id`),
  KEY `IDX_DA13B6DD166D1F9C` (`project_id`),
  KEY `IDX_DA13B6DD3B188DF8` (`paymethod_id`),
  KEY `IDX_DA13B6DDC8CB8B1C` (`billstatus_id`),
  KEY `IDX_DA13B6DD84BBDA7` (`coin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `BillStatus`
--

CREATE TABLE IF NOT EXISTS `BillStatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` 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 `BillStatus2`
--

CREATE TABLE IF NOT EXISTS `BillStatus2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` 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 `Bundle`
--

CREATE TABLE IF NOT EXISTS `Bundle` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `entry` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `budgetStatus` 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 `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 `Coin`
--

CREATE TABLE IF NOT EXISTS `Coin` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `coin` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `coincode` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `coinsymbol` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

--
-- Bolcant dades de la taula `Coin`
--

INSERT INTO `Coin` (`id`, `coin`, `coincode`, `coinsymbol`) VALUES
(1, 'euro', 'EUR', ''),
(2, 'US Dolar', 'USD', '$');

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

--
-- 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=251 ;

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

--
-- 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=1 ;

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

--
-- 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=2 ;

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

--
-- Estructura de la taula `Entry`
--

CREATE TABLE IF NOT EXISTS `Entry` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `reference` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `phase` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `workpackage` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Total` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Deviation` varchar(255) 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 `EntryRecord`
--

CREATE TABLE IF NOT EXISTS `EntryRecord` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usermodificator_id` int(11) DEFAULT NULL,
  `entry_id` int(11) DEFAULT NULL,
  `date` datetime DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `phase` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `workpackage` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `total` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_14269A4AE77E3D5` (`usermodificator_id`),
  KEY `IDX_14269A4ABA364942` (`entry_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- 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, '2014-02-26 00:00:00');

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

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

CREATE TABLE IF NOT EXISTS `Groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `widget_id` int(11) DEFAULT NULL,
  `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`),
  KEY `IDX_F7C13C46FBE885E2` (`widget_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=15 ;

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

INSERT INTO `Groups` (`id`, `widget_id`, `name`, `role`) VALUES
(1, NULL, 'Administrators', 'ROLE_ADMIN'),
(2, NULL, 'Users', 'ROLE_USER'),
(3, NULL, 'Staffers', 'ROLE_STAFF'),
(4, NULL, 'Superstaffer', 'ROLE_SUPER_STAFF'),
(5, NULL, 'Writers', 'ROLE_WRITER'),
(6, NULL, 'Viewers', 'ROLE_VIEWER'),
(7, NULL, 'Readers', 'ROLE_READER'),
(9, NULL, 'Test', 'ROLE_TEST'),
(10, NULL, 'Developers', 'ROLE_DEVELOPER'),
(11, NULL, 'RM v2', 'ROLE_RMV2'),
(12, NULL, 'Bronze Star', 'ROLE_BRONZESTAR'),
(13, NULL, 'Silver Star', 'ROLE_SILVERSTAR'),
(14, NULL, 'Gold Star', 'ROLE_GOLDSTAR');

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

--
-- 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`
--

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

--
-- Estructura de la taula `Invitation`
--

CREATE TABLE IF NOT EXISTS `Invitation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `creator_id` int(11) NOT NULL,
  `lastmodified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `Item`
--

CREATE TABLE IF NOT EXISTS `Item` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `entry_id` int(11) DEFAULT NULL,
  `registerDate` time DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `ammount` double NOT NULL,
  `unitPrice` double NOT NULL,
  `units` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `itemStatus_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_BF298A20ABCB0FB5` (`itemStatus_id`),
  KEY `IDX_BF298A20BA364942` (`entry_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `itemStatus`
--

CREATE TABLE IF NOT EXISTS `itemStatus` (
  `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=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 `Line`
--

CREATE TABLE IF NOT EXISTS `Line` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `typeline_id` int(11) DEFAULT NULL,
  `tax_id` int(11) DEFAULT NULL,
  `tax2_id` int(11) DEFAULT NULL,
  `transactional_id` int(11) DEFAULT NULL,
  `amount` double NOT NULL,
  `unit` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `price` double NOT NULL,
  `discount` double DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `billingschedule` date NOT NULL,
  `deliveryschedule` date NOT NULL,
  `tax3` double DEFAULT NULL,
  `signaturestate` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_71261BC8979FF9F9` (`typeline_id`),
  KEY `IDX_71261BC8B2A824D8` (`tax_id`),
  KEY `IDX_71261BC84C6370BF` (`tax2_id`),
  KEY `IDX_71261BC835E6B3C3` (`transactional_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `LineBill`
--

CREATE TABLE IF NOT EXISTS `LineBill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `line_id` int(11) DEFAULT NULL,
  `bill_id` int(11) DEFAULT NULL,
  `amount` double NOT NULL,
  `price` double NOT NULL,
  `tax1` double NOT NULL,
  `tax2` double NOT NULL,
  `discount` double NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_9D45FE2B4D7B7542` (`line_id`),
  KEY `IDX_9D45FE2B1A8C12F5` (`bill_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `LineWaybill`
--

CREATE TABLE IF NOT EXISTS `LineWaybill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `line_id` int(11) DEFAULT NULL,
  `bill_id` int(11) DEFAULT NULL,
  `amount` double NOT NULL,
  `price` double NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_1CF0AE104D7B7542` (`line_id`),
  KEY `IDX_1CF0AE101A8C12F5` (`bill_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `Menuitem`
--

CREATE TABLE IF NOT EXISTS `Menuitem` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `widget_id` int(11) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_33A79080FBE885E2` (`widget_id`),
  KEY `IDX_33A79080727ACA70` (`parent_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=22 ;

--
-- Bolcant dades de la taula `Menuitem`
--

INSERT INTO `Menuitem` (`id`, `widget_id`, `parent_id`, `name`, `link`, `enabled`) VALUES
(1, 3, NULL, 'File Manager', '', 1),
(2, 3, 1, 'File Manager', 'fm', 1),
(3, 1, NULL, 'Project Definition', '', 1),
(4, 1, 3, 'Project Definition', 'project_show', 1),
(5, 2, NULL, 'Time Control', '', 1),
(6, 2, 5, 'Time Control', 'time_control_homepage', 1),
(7, 4, NULL, 'Team Manager', '', 1),
(8, 4, 7, 'Team', 'neo_team_manager_homepage', 1),
(9, 6, NULL, 'Expenses Control', '', 1),
(10, 6, 9, 'Menu Expenses Control', 'expenses_control_homepage', 1),
(11, 6, 9, 'Buy Orders', 'expenses_control_offer', 1),
(12, 6, 9, 'Sell Orders', 'expenses_control_demand', 1),
(13, 6, 9, 'New Buy Order', 'expenses_control_transaction_new_buy_order', 1),
(14, 6, 9, 'New Sell Order', 'expenses_control_transaction_create_sell_order', 1),
(15, 6, 9, 'Invoices Received', 'expenses_control_invoice_received', 1),
(16, 6, 9, 'Invoices Sent', 'expenses_control_invoice_sent', 1),
(17, 6, 9, 'Preferences', 'expenses_control_configurator', 1),
(18, 7, NULL, 'Time manager', 'showProjectStatus', 1),
(19, 7, 18, 'New task', 'task_new', 1),
(20, 7, 18, 'Project information', 'showProjectInfo', 1),
(21, 7, 18, 'Project status (graph)', 'showProjectStatus', 1);

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

--
-- 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,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `startdate` date NOT NULL,
  `enddate` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- 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 `ProfileRequests`
--

CREATE TABLE IF NOT EXISTS `ProfileRequests` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `requestDate` date NOT NULL,
  `startDate` date DEFAULT NULL,
  `endDate` date DEFAULT NULL,
  `requestedstartDate` date NOT NULL,
  `requestedendDate` date DEFAULT NULL,
  `dailyhours` double DEFAULT NULL,
  `requesteddailyhours` double NOT NULL,
  `totalhours` double DEFAULT NULL,
  `requestedtotalhours` double NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `status` int(11) DEFAULT NULL,
  `profile_id` int(11) DEFAULT NULL,
  `project_id` int(11) NOT NULL,
  `petitioneruser_id` int(11) DEFAULT NULL,
  `assigneduser` int(11) DEFAULT NULL,
  `supervidsor` int(11) DEFAULT NULL,
  `position` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lastmodified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`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,
  `country_id` int(11) DEFAULT NULL,
  `status_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `completename` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `projectcode` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `projectlink` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `projectsummary` longtext COLLATE utf8_unicode_ci,
  `creationDate` datetime DEFAULT NULL,
  `startdate` date DEFAULT NULL,
  `enddate` date DEFAULT NULL,
  `budget` decimal(10,0) DEFAULT NULL,
  `projectreferencecoin` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `hoursman` decimal(10,0) DEFAULT NULL,
  `shared` tinyint(1) DEFAULT NULL,
  `self` tinyint(1) DEFAULT NULL,
  `userCreator_id` int(11) DEFAULT NULL,
  `idcolabora` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_E00EE972F92F3E70` (`country_id`),
  KEY `IDX_E00EE9726BF700BD` (`status_id`),
  KEY `IDX_E00EE9726303218F` (`userCreator_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

--
-- Bolcant dades de la taula `Project`
--

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

--
-- 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=1 ;

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

--
-- 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 `RH_Expenses`
--

CREATE TABLE IF NOT EXISTS `RH_Expenses` (
  `id` int(11) NOT NULL,
  `coin_id` int(11) DEFAULT NULL,
  `paymethod_id` int(11) DEFAULT NULL,
  `registerhours_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `cost` double NOT NULL,
  `registrationdate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `IDX_D311529E84BBDA7` (`coin_id`),
  KEY `IDX_D311529E3B188DF8` (`paymethod_id`),
  KEY `IDX_D311529E17813E85` (`registerhours_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estructura de la taula `RH_Paymethod`
--

CREATE TABLE IF NOT EXISTS `RH_Paymethod` (
  `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 `RH_RegisterHours`
--

CREATE TABLE IF NOT EXISTS `RH_RegisterHours` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `project_id` int(11) DEFAULT NULL,
  `enteprise_id` int(11) DEFAULT NULL,
  `type_id` int(11) DEFAULT NULL,
  `type2_id` int(11) DEFAULT NULL,
  `registrationdate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `date` date DEFAULT NULL,
  `time` double NOT NULL,
  `distance` double DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_A93C9186A76ED395` (`user_id`),
  KEY `IDX_A93C9186166D1F9C` (`project_id`),
  KEY `IDX_A93C9186F3060E4C` (`enteprise_id`),
  KEY `IDX_A93C9186C54C8C93` (`type_id`),
  KEY `IDX_A93C9186AD1A0C0F` (`type2_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estructura de la taula `RH_TypeExpenses`
--

CREATE TABLE IF NOT EXISTS `RH_TypeExpenses` (
  `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 `RH_TypeHours`
--

CREATE TABLE IF NOT EXISTS `RH_TypeHours` (
  `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 `RH_TypeHoursEnterprise`
--

CREATE TABLE IF NOT EXISTS `RH_TypeHoursEnterprise` (
  `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 `Server`
--

CREATE TABLE IF NOT EXISTS `Server` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `dbName` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `dbHost` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `dbUser` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `dbPassword` varchar(100) 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 `Task`
--

CREATE TABLE IF NOT EXISTS `Task` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `creationuser_id` int(11) DEFAULT NULL,
  `responsibleuser_id` int(11) DEFAULT NULL,
  `status_id` int(11) DEFAULT NULL,
  `workpackage_id` int(11) DEFAULT NULL,
  `phase_id` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `isTaskDefinedByContract` tinyint(1) NOT NULL,
  `initialPlannedHours` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `isInitialPlannedHoursBBC` tinyint(1) NOT NULL,
  `currentlyPlannedHours` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `taskCreationDate` date NOT NULL,
  `description` tinytext COLLATE utf8_unicode_ci NOT NULL,
  `isResponsableUserBBC` tinyint(1) NOT NULL,
  `launchDate` date NOT NULL,
  `isLaunched` tinyint(1) NOT NULL,
  `deadline` date NOT NULL,
  `isDeadlineBBC` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_F24C741B300AEC63` (`creationuser_id`),
  KEY `IDX_F24C741B47434402` (`responsibleuser_id`),
  KEY `IDX_F24C741B6BF700BD` (`status_id`),
  KEY `IDX_F24C741BDBD8A2B7` (`workpackage_id`),
  KEY `IDX_F24C741B99091188` (`phase_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `TaskLinks`
--

CREATE TABLE IF NOT EXISTS `TaskLinks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `task_id` int(11) DEFAULT NULL,
  `linkName` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `linkUrl` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `linkDescription` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_BC24E8DF8DB60186` (`task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `TaskRecord`
--

CREATE TABLE IF NOT EXISTS `TaskRecord` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `recorduser_id` int(11) DEFAULT NULL,
  `responsibleuser_id` int(11) DEFAULT NULL,
  `task_id` int(11) DEFAULT NULL,
  `recordDate` date NOT NULL,
  `additionalHours` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `deadline` date NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_9E596ECB3C017268` (`recorduser_id`),
  KEY `IDX_9E596ECB47434402` (`responsibleuser_id`),
  KEY `IDX_9E596ECB8DB60186` (`task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `TaskStatus`
--

CREATE TABLE IF NOT EXISTS `TaskStatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` 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 `Tax`
--

CREATE TABLE IF NOT EXISTS `Tax` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tax` double NOT NULL,
  `bydefault` 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 `Tax2`
--

CREATE TABLE IF NOT EXISTS `Tax2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tax` double NOT NULL,
  `bydefault` 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 `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 `Transactional`
--

CREATE TABLE IF NOT EXISTS `Transactional` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status_id` int(11) DEFAULT NULL,
  `coin_id` int(11) DEFAULT NULL,
  `originenterprise_id` int(11) DEFAULT NULL,
  `originuser_id` int(11) DEFAULT NULL,
  `targetenterprise_id` int(11) DEFAULT NULL,
  `targetuser_id` int(11) DEFAULT NULL,
  `paymethod_id` int(11) DEFAULT NULL,
  `signer_id` int(11) DEFAULT NULL,
  `ordernumber` double NOT NULL,
  `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `suma` double DEFAULT NULL,
  `tax` double DEFAULT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_220C5C796BF700BD` (`status_id`),
  KEY `IDX_220C5C7984BBDA7` (`coin_id`),
  KEY `IDX_220C5C793D4F4813` (`originenterprise_id`),
  KEY `IDX_220C5C79F98768AB` (`originuser_id`),
  KEY `IDX_220C5C791374AB3B` (`targetenterprise_id`),
  KEY `IDX_220C5C795757D3A6` (`targetuser_id`),
  KEY `IDX_220C5C793B188DF8` (`paymethod_id`),
  KEY `IDX_220C5C799588C067` (`signer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `Transactionalstatus`
--

CREATE TABLE IF NOT EXISTS `Transactionalstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` 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 `TypeLine`
--

CREATE TABLE IF NOT EXISTS `TypeLine` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `typeline` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `bydefault` 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 `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 `User`
--

CREATE TABLE IF NOT EXISTS `User` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `country_id` int(11) DEFAULT NULL,
  `language_id` int(11) DEFAULT NULL,
  `address_id` int(11) DEFAULT NULL,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `username_canonical` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `email_canonical` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  `salt` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `last_login` datetime DEFAULT NULL,
  `locked` tinyint(1) NOT NULL,
  `expired` tinyint(1) NOT NULL,
  `expires_at` datetime DEFAULT NULL,
  `confirmation_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `password_requested_at` datetime DEFAULT NULL,
  `roles` longtext COLLATE utf8_unicode_ci NOT NULL COMMENT '(DC2Type:array)',
  `credentials_expired` tinyint(1) NOT NULL,
  `credentials_expire_at` datetime DEFAULT NULL,
  `idcolabora` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `picturePath` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `middleNames` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lastNames` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `publicName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `dateofbirth` date DEFAULT NULL,
  `islevel1` tinyint(1) DEFAULT NULL,
  `dateformat` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQ_2DA1797792FC23A8` (`username_canonical`),
  UNIQUE KEY `UNIQ_2DA17977A0D96FBF` (`email_canonical`),
  KEY `IDX_2DA17977F92F3E70` (`country_id`),
  KEY `IDX_2DA1797782F1BAF4` (`language_id`),
  KEY `IDX_2DA17977F5B7AF75` (`address_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=14 ;

--
-- Bolcant dades de la taula `User`
--

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

--
-- Estructura de la taula `UserEnterprise`
--

CREATE TABLE IF NOT EXISTS `UserEnterprise` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `enterprise_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_7EF63DF2A76ED395` (`user_id`),
  KEY `IDX_7EF63DF2A97D1AC3` (`enterprise_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

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

--
-- 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=1 ;

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

--
-- Estructura de la taula `Waybill`
--

CREATE TABLE IF NOT EXISTS `Waybill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `targetenterprise_id` int(11) DEFAULT NULL,
  `paymethod_id` int(11) DEFAULT NULL,
  `coin_id` int(11) DEFAULT NULL,
  `waybillnumber` double NOT NULL,
  `emissiondate` datetime NOT NULL,
  `expirationdate` datetime NOT NULL,
  `project` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `billstatus` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `billingstatus` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_171190F91374AB3B` (`targetenterprise_id`),
  KEY `IDX_171190F93B188DF8` (`paymethod_id`),
  KEY `IDX_171190F984BBDA7` (`coin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

--
-- Estructura de la taula `Widget`
--

CREATE TABLE IF NOT EXISTS `Widget` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bundleControllerAction` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `version` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `route` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `status` tinyint(1) NOT NULL,
  `picturepath` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=8 ;

--
-- Bolcant dades de la taula `Widget`
--

INSERT INTO `Widget` (`id`, `bundleControllerAction`, `name`, `version`, `route`, `status`, `picturepath`) VALUES
(1, 'ProjectDefinitionBundle:Widget:widget', 'Project Definition', 'Project Definition', 'project_show', 1, NULL),
(2, 'TimeControlBundle:Widget:widget', 'Time Control', 'Time Control', 'time_control_homepage', 1, NULL),
(3, 'fmBundle:Widget:widget', 'File Manager', 'File Manager', 'fm', 1, NULL),
(4, 'TeamManagerBundle:Widget:widget', 'Team Manager', 'Team Manager', 'neo_team_manager_homepage', 1, NULL),
(6, 'ExpensesControlBundle:Widget:widget', 'Expenses Control', 'Expenses Control', 'expenses_control_homepage', 1, NULL),
(7, 'TimeManagerBundle:Widget:widget', 'TimeManagerBundle', 'TimeManagerBundle', 'showProjectStatus', 1, NULL);

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

--
-- Estructura de la taula `WorkedHoursRecord`
--

CREATE TABLE IF NOT EXISTS `WorkedHoursRecord` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `task_id` int(11) DEFAULT NULL,
  `recordDate` date NOT NULL,
  `hours` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_A98A3C938DB60186` (`task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

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

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

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

--
-- 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 `Bill`
--
ALTER TABLE `Bill`
  ADD CONSTRAINT `FK_DA13B6DD84BBDA7` FOREIGN KEY (`coin_id`) REFERENCES `Coin` (`id`),
  ADD CONSTRAINT `FK_DA13B6DD1374AB3B` FOREIGN KEY (`targetenterprise_id`) REFERENCES `Enterprises` (`id`),
  ADD CONSTRAINT `FK_DA13B6DD166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_DA13B6DD3B188DF8` FOREIGN KEY (`paymethod_id`) REFERENCES `RH_Paymethod` (`id`),
  ADD CONSTRAINT `FK_DA13B6DDC8CB8B1C` FOREIGN KEY (`billstatus_id`) REFERENCES `BillStatus2` (`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 `EntryRecord`
--
ALTER TABLE `EntryRecord`
  ADD CONSTRAINT `FK_14269A4ABA364942` FOREIGN KEY (`entry_id`) REFERENCES `Entry` (`id`),
  ADD CONSTRAINT `FK_14269A4AE77E3D5` FOREIGN KEY (`usermodificator_id`) REFERENCES `User` (`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 `Groups`
--
ALTER TABLE `Groups`
  ADD CONSTRAINT `FK_F7C13C46FBE885E2` FOREIGN KEY (`widget_id`) REFERENCES `Widget` (`id`);

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

--
-- Restriccions per la taula `Item`
--
ALTER TABLE `Item`
  ADD CONSTRAINT `FK_BF298A20BA364942` FOREIGN KEY (`entry_id`) REFERENCES `Entry` (`id`),
  ADD CONSTRAINT `FK_BF298A20ABCB0FB5` FOREIGN KEY (`itemStatus_id`) REFERENCES `itemStatus` (`id`);

--
-- Restriccions per la taula `Line`
--
ALTER TABLE `Line`
  ADD CONSTRAINT `FK_71261BC835E6B3C3` FOREIGN KEY (`transactional_id`) REFERENCES `Transactional` (`id`),
  ADD CONSTRAINT `FK_71261BC84C6370BF` FOREIGN KEY (`tax2_id`) REFERENCES `Tax2` (`id`),
  ADD CONSTRAINT `FK_71261BC8979FF9F9` FOREIGN KEY (`typeline_id`) REFERENCES `TypeLine` (`id`),
  ADD CONSTRAINT `FK_71261BC8B2A824D8` FOREIGN KEY (`tax_id`) REFERENCES `Tax` (`id`);

--
-- Restriccions per la taula `LineBill`
--
ALTER TABLE `LineBill`
  ADD CONSTRAINT `FK_9D45FE2B1A8C12F5` FOREIGN KEY (`bill_id`) REFERENCES `Bill` (`id`),
  ADD CONSTRAINT `FK_9D45FE2B4D7B7542` FOREIGN KEY (`line_id`) REFERENCES `Line` (`id`);

--
-- Restriccions per la taula `LineWaybill`
--
ALTER TABLE `LineWaybill`
  ADD CONSTRAINT `FK_1CF0AE101A8C12F5` FOREIGN KEY (`bill_id`) REFERENCES `Waybill` (`id`),
  ADD CONSTRAINT `FK_1CF0AE104D7B7542` FOREIGN KEY (`line_id`) REFERENCES `Line` (`id`);

--
-- Restriccions per la taula `Menuitem`
--
ALTER TABLE `Menuitem`
  ADD CONSTRAINT `FK_33A79080727ACA70` FOREIGN KEY (`parent_id`) REFERENCES `Menuitem` (`id`),
  ADD CONSTRAINT `FK_33A79080FBE885E2` FOREIGN KEY (`widget_id`) REFERENCES `Widget` (`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_D37EFB26A76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_D37EFB261B7FD535` FOREIGN KEY (`notificationTemplate_id`) REFERENCES `NotificationTemplates` (`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_E00EE9726303218F` FOREIGN KEY (`userCreator_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_E00EE9726BF700BD` FOREIGN KEY (`status_id`) REFERENCES `Projectstatus` (`id`),
  ADD CONSTRAINT `FK_E00EE972F92F3E70` FOREIGN KEY (`country_id`) REFERENCES `Countries` (`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 `RH_Expenses`
--
ALTER TABLE `RH_Expenses`
  ADD CONSTRAINT `FK_D311529E17813E85` FOREIGN KEY (`registerhours_id`) REFERENCES `RH_RegisterHours` (`id`),
  ADD CONSTRAINT `FK_D311529E3B188DF8` FOREIGN KEY (`paymethod_id`) REFERENCES `RH_Paymethod` (`id`),
  ADD CONSTRAINT `FK_D311529E84BBDA7` FOREIGN KEY (`coin_id`) REFERENCES `Coin` (`id`);

--
-- Restriccions per la taula `RH_RegisterHours`
--
ALTER TABLE `RH_RegisterHours`
  ADD CONSTRAINT `FK_A93C9186AD1A0C0F` FOREIGN KEY (`type2_id`) REFERENCES `RH_TypeHours` (`id`),
  ADD CONSTRAINT `FK_A93C9186166D1F9C` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`),
  ADD CONSTRAINT `FK_A93C9186A76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_A93C9186C54C8C93` FOREIGN KEY (`type_id`) REFERENCES `RH_TypeHoursEnterprise` (`id`),
  ADD CONSTRAINT `FK_A93C9186F3060E4C` FOREIGN KEY (`enteprise_id`) REFERENCES `Enterprises` (`id`);

--
-- Restriccions per la taula `Task`
--
ALTER TABLE `Task`
  ADD CONSTRAINT `FK_F24C741B99091188` FOREIGN KEY (`phase_id`) REFERENCES `Phase` (`id`),
  ADD CONSTRAINT `FK_F24C741B300AEC63` FOREIGN KEY (`creationuser_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_F24C741B47434402` FOREIGN KEY (`responsibleuser_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_F24C741B6BF700BD` FOREIGN KEY (`status_id`) REFERENCES `TaskStatus` (`id`),
  ADD CONSTRAINT `FK_F24C741BDBD8A2B7` FOREIGN KEY (`workpackage_id`) REFERENCES `Workpackage` (`id`);

--
-- Restriccions per la taula `TaskLinks`
--
ALTER TABLE `TaskLinks`
  ADD CONSTRAINT `FK_BC24E8DF8DB60186` FOREIGN KEY (`task_id`) REFERENCES `Task` (`id`);

--
-- Restriccions per la taula `TaskRecord`
--
ALTER TABLE `TaskRecord`
  ADD CONSTRAINT `FK_9E596ECB8DB60186` FOREIGN KEY (`task_id`) REFERENCES `Task` (`id`),
  ADD CONSTRAINT `FK_9E596ECB3C017268` FOREIGN KEY (`recorduser_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_9E596ECB47434402` FOREIGN KEY (`responsibleuser_id`) REFERENCES `User` (`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 `Transactional`
--
ALTER TABLE `Transactional`
  ADD CONSTRAINT `FK_220C5C799588C067` FOREIGN KEY (`signer_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_220C5C791374AB3B` FOREIGN KEY (`targetenterprise_id`) REFERENCES `Enterprises` (`id`),
  ADD CONSTRAINT `FK_220C5C793B188DF8` FOREIGN KEY (`paymethod_id`) REFERENCES `RH_Paymethod` (`id`),
  ADD CONSTRAINT `FK_220C5C793D4F4813` FOREIGN KEY (`originenterprise_id`) REFERENCES `UserEnterprise` (`id`),
  ADD CONSTRAINT `FK_220C5C795757D3A6` FOREIGN KEY (`targetuser_id`) REFERENCES `User` (`id`),
  ADD CONSTRAINT `FK_220C5C796BF700BD` FOREIGN KEY (`status_id`) REFERENCES `Transactionalstatus` (`id`),
  ADD CONSTRAINT `FK_220C5C7984BBDA7` FOREIGN KEY (`coin_id`) REFERENCES `Coin` (`id`),
  ADD CONSTRAINT `FK_220C5C79F98768AB` FOREIGN KEY (`originuser_id`) REFERENCES `User` (`id`);

--
-- Restriccions per la taula `User`
--
ALTER TABLE `User`
  ADD CONSTRAINT `FK_2DA17977F5B7AF75` FOREIGN KEY (`address_id`) REFERENCES `Addresses` (`id`),
  ADD CONSTRAINT `FK_2DA1797782F1BAF4` FOREIGN KEY (`language_id`) REFERENCES `Languages` (`id`),
  ADD CONSTRAINT `FK_2DA17977F92F3E70` FOREIGN KEY (`country_id`) REFERENCES `Countries` (`id`);

--
-- Restriccions per la taula `UserEnterprise`
--
ALTER TABLE `UserEnterprise`
  ADD CONSTRAINT `FK_7EF63DF2A97D1AC3` FOREIGN KEY (`enterprise_id`) REFERENCES `Enterprises` (`id`),
  ADD CONSTRAINT `FK_7EF63DF2A76ED395` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`);

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

--
-- Restriccions per la taula `Waybill`
--
ALTER TABLE `Waybill`
  ADD CONSTRAINT `FK_171190F984BBDA7` FOREIGN KEY (`coin_id`) REFERENCES `Coin` (`id`),
  ADD CONSTRAINT `FK_171190F91374AB3B` FOREIGN KEY (`targetenterprise_id`) REFERENCES `Enterprises` (`id`),
  ADD CONSTRAINT `FK_171190F93B188DF8` FOREIGN KEY (`paymethod_id`) REFERENCES `RH_Paymethod` (`id`);

--
-- Restriccions per la taula `WorkedHoursRecord`
--
ALTER TABLE `WorkedHoursRecord`
  ADD CONSTRAINT `FK_A98A3C938DB60186` FOREIGN KEY (`task_id`) REFERENCES `Task` (`id`);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
