-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Mer 19 Février 2014 à 21:09
-- Version du serveur: 5.6.16
-- Version de PHP: 5.4.17




--
-- Base de données: `test`
--

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

--
-- Structure de la table `account`
--

CREATE TABLE IF NOT EXISTS `account` (
  `account_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) DEFAULT NULL,
  `account_name` varchar(255) DEFAULT NULL,
  `balance` bigint(20) DEFAULT '0',
  PRIMARY KEY (`account_id`),
  KEY `user_id_idx` (`user_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Contenu de la table `account`
--

INSERT INTO `account` (`account_id`, `user_id`, `account_name`, `balance`) VALUES
(9, 1, 'zefez', 1223),
(10, 1, 'regregrqe', 11);

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

--
-- Structure de la table `operation`
--

CREATE TABLE IF NOT EXISTS `operation` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `account_id` bigint(20) DEFAULT NULL,
  `type_id` bigint(20) DEFAULT NULL,
  `operation_date` date NOT NULL,
  `operation_name` text,
  `operation_desc` text,
  `is_credit` tinyint(1) NOT NULL,
  `value` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `account_id_idx` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `payment_type`
--

CREATE TABLE IF NOT EXISTS `payment_type` (
  `type_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `type_name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`type_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Contenu de la table `payment_type`
--

INSERT INTO `payment_type` (`type_id`, `type_name`) VALUES
(1, 'Cheque'),
(2, 'Carte bleue'),
(3, 'Liquide'),
(4, 'Virement'),
(5, 'Moneo');

--
-- Contraintes pour les tables exportées
--

--
-- Contraintes pour la table `account`
--
ALTER TABLE `account`
  ADD CONSTRAINT `account_user_id_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`);

--
-- Contraintes pour la table `operation`
--
ALTER TABLE `operation`
  ADD CONSTRAINT `operation_account_id_account_account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`) ON DELETE CASCADE;

