-- phpMyAdmin SQL Dump
-- version 4.2.12deb2+deb8u2
-- http://www.phpmyadmin.net
--
-- Client :  localhost
-- Généré le :  Dim 05 Novembre 2017 à 02:06
-- Version du serveur :  5.5.58-0+deb8u1
-- Version de PHP :  5.6.30-0+deb8u1

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 données :  `platform_iot`
--

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

--
-- Structure de la table `service`
--

CREATE TABLE IF NOT EXISTS `service` (
`id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `type` varchar(20) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Contenu de la table `service`
--

INSERT INTO `service` (`id`, `name`, `type`) VALUES
(1, 'myKWHome', 'smarthome'),
(2, 'FridgAlert', 'smarthome'),
(3, 'RUNstats', 'quantifiedself'),
(4, 'traCARE', 'quantifiedself'),
(5, 'dogWATCH', NULL),
(6, 'CarUse', NULL);

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

--
-- Structure de la table `subscribe`
--

CREATE TABLE IF NOT EXISTS `subscribe` (
  `id_user` int(11) NOT NULL,
  `id_service` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Contenu de la table `subscribe`
--

INSERT INTO `subscribe` (`id_user`, `id_service`) VALUES
(2, 1),
(2, 2),
(1, 3);

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

--
-- Structure de la table `thing`
--

CREATE TABLE IF NOT EXISTS `thing` (
  `mac` varchar(17) NOT NULL,
  `id_user` int(11) NOT NULL,
  `type` varchar(20) DEFAULT NULL,
  `parameter` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Contenu de la table `thing`
--

INSERT INTO `thing` (`mac`, `id_user`, `type`, `parameter`) VALUES
('f0:de:f1:39:7f:17', 1, NULL, NULL),
('f0:de:f1:39:7f:18', 2, NULL, NULL),
('f0:de:f1:39:7f:19', 2, 'thingtempo', '60'),
('f0:de:f1:39:7f:20', 2, 'thingtempo', '1.5'),
('f0:de:f1:39:7f:21', 4, NULL, NULL),
('f0:de:f1:39:7f:22', 4, NULL, NULL);

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

--
-- Structure de la table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL,
  `firstname` varchar(100) NOT NULL,
  `lastname` varchar(100) NOT NULL,
  `email` varchar(100) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

--
-- Contenu de la table `user`
--

INSERT INTO `user` (`id`, `firstname`, `lastname`, `email`) VALUES
(1, 'Amaya', 'URSUYA', 'amaya@domain.com'),
(2, 'Maialen', 'HOLZARTE', 'm.holzarte@company.fr'),
(3, 'Pantxika', 'CENITZ', 'pantxi@sjdl.eus'),
(4, 'Maylis', 'ACOTZ', 'mayli40@sjdl.eus'),
(5, 'Elorri', 'IBARDINE', 'elo.iba@lepoa.fr'),
(6, 'Maika', 'IROULEGUY', 'maika@irouleguy.eu'),
(7, 'Maider', 'JAIZKIBEL', 'mai64@olatu.fr'),
(8, 'Arantxa', 'IPARLA', 'a.iparla@mendia.fr'),
(9, 'Mayana', 'URCURAY', 'm.urcuray@mendia.fr');

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

--
-- Index pour la table `service`
--
ALTER TABLE `service`
 ADD PRIMARY KEY (`id`);

--
-- Index pour la table `subscribe`
--
ALTER TABLE `subscribe`
 ADD PRIMARY KEY (`id_user`,`id_service`), ADD KEY `id_service` (`id_service`);

--
-- Index pour la table `thing`
--
ALTER TABLE `thing`
 ADD PRIMARY KEY (`mac`), ADD KEY `id_user` (`id_user`);

--
-- Index pour la table `user`
--
ALTER TABLE `user`
 ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT pour les tables exportées
--

--
-- AUTO_INCREMENT pour la table `service`
--
ALTER TABLE `service`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT pour la table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- Contraintes pour les tables exportées
--

--
-- Contraintes pour la table `subscribe`
--
ALTER TABLE `subscribe`
ADD CONSTRAINT `subscribe_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`),
ADD CONSTRAINT `subscribe_ibfk_2` FOREIGN KEY (`id_service`) REFERENCES `service` (`id`);

--
-- Contraintes pour la table `thing`
--
ALTER TABLE `thing`
ADD CONSTRAINT `thing_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`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 */;
