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

--
-- Structure de la table `emails`
--

CREATE TABLE `emails` (
  `email_id` integer primary key autoincrement,
  `from_person_id` int(11) NOT NULL,
  `subject` varchar(250) NOT NULL,
  `body` text NOT NULL,
  `timestamp` datetime NOT NULL
) ;

--
-- Contenu de la table `emails`
--

INSERT INTO `emails` (`email_id`, `from_person_id`, `subject`, `body`, `timestamp`) VALUES
(1, 1, 'Hello', 'Hello! How are you? I am fine.\r\n\r\nEmmanuel', '2016-11-09 07:00:00'),
(2, 3, 'Engagement', 'Dear Michael,\r\nI love you so much....\r\n\r\nNick', '1917-03-02 08:00:00'),
(3, 4, 'Re: Engagement', 'Dear Nick,\r\nDo you want to marry me?\r\n\r\nMichael', '1917-03-02 09:00:00'),
(4, 4, 'Last will', 'Here are my last will,\r\nMy wealth should go to my fiancé Magdala Bucket.\r\n\r\nM. Seaton', '1917-12-31 00:00:00');

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

--
-- Structure de la table `persons`
--

CREATE TABLE `persons` (
  `person_id` integer primary key autoincrement,
  `address` varchar(250) NOT NULL,
  `first_name` varchar(75) NOT NULL,
  `last_name` varchar(75) NOT NULL,
  `gender` tinyint(1) NOT NULL,
  `birth_date` date NOT NULL
);

--
-- Contenu de la table `persons`
--

INSERT INTO `persons` (`person_id`, `address`, `first_name`, `last_name`, `gender`, `birth_date`) VALUES
(1, 'emmanuel.esc@gmail.com', 'Emmanuel', 'Benoist', 0, '1970-02-08'),
(2, 'david-olivier@monmail.com', 'David-Olivier', 'Jaquet-Chiffelle', 0, '1965-03-09'),
(3, 'nick@christie.co.uk', 'Magdala', 'Buckey', 1, '1885-04-19'),
(4, 'michael.seton@christie.co.uk', 'Michael', 'Seton', 0, '1879-12-19'),
(5, 'hercule.poirot@unil.ch', 'Hercule', 'Poirot', 0, '1860-10-04');

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

--
-- Structure de la table `to_emails_persons`
--

CREATE TABLE `to_emails_persons` (
  `to_emails_persons_id` integer primary key autoincrement,
  `person_id_to` int(11) NOT NULL,
  `email_id` int(11) NOT NULL
);

--
-- Contenu de la table `to_emails_persons`
--

INSERT INTO `to_emails_persons` (`to_emails_persons_id`, `person_id_to`, `email_id`) VALUES
(1, 2, 1),
(2, 4, 2),
(3, 3, 3);

--
-- Index pour les tables exportées
--

--
-- Structure de la table `cc_emails_persons`
--

CREATE TABLE `cc_emails_persons` (
  `cc_emails_persons_id` integer primary key autoincrement,
  `person_id_cc` int(11) NOT NULL,
  `email_id` int(11) NOT NULL
);


-- In our example, we do not have any CC in emails
