Commit fadcd735 authored by thejoelinux's avatar thejoelinux

modif contructeurs nom des tables

parent 94c96d59
<?php
header("Location: webroot/", true, 302);
exit();
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: `ludotheque`
--
-- --------------------------------------------------------
--
-- Structure de la table `esar_categories`
--
CREATE TABLE IF NOT EXISTS `esar_categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(128) DEFAULT NULL,
`label` varchar(16) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=34 ;
--
-- Contenu de la table `esar_categories`
--
INSERT INTO `esar_categories` (`id`, `name`, `label`, `created_at`, `updated_at`) VALUES
(1, 'Jeu de construction', 'A01', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(2, 'Jeu d''agencement', 'A02', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(3, 'Jeu de montage mecanique', 'A03', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(4, 'Jeu de montage electromecanique', 'A04', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(5, 'Jeu de montage electronique', 'A05', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(6, 'Jeu de montage scientifique', 'A06', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(7, 'Jeu de montage robotise', 'A07', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(8, 'Jeu de montage virtuel', 'A08', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(9, 'Jeu sensoriel sonore', 'E01', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(10, 'Jeu sensoriel visuel', 'E02', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(11, 'Jeu sensoriel tactile', 'E03', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(12, 'Jeu sensoriel olfactif', 'E04', '0000-00-00 00:00:00', '2015-11-22 23:23:46'),
(13, 'Jeu sensoriel gustatif', 'E05', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(14, 'Jeu moteur', 'E06', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(15, 'Jeu de manipulation', 'E07', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(16, 'Jeu d''action-reaction virtuel', 'E08', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(17, 'Jeu de role', 'S01', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(18, 'Jeu de mise en scene', 'S02', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(19, 'Jeu de production', 'S03', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(20, 'Jeu de production en 3 dimensions', 'S04', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(21, 'Jeu de simulation virtuel', 'S05', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(22, 'Jeu d''association', 'R01', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(23, 'Jeu de sequence', 'R02', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(24, 'Jeu de circuit', 'R03', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(25, 'Jeu d''adresse', 'R04', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(26, 'Jeu sportif', 'R05', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(27, 'Jeu de strategie', 'R06', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(28, 'Jeu de hasard', 'R07', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(29, 'Jeu questionnaire', 'R08', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(30, 'Jeu mathematique', 'R09', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(31, 'Jeu de langue', 'R10', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(32, 'Jeu d''enigme', 'R11', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(33, 'Jeu de regles virtuel', 'R12', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Structure de la table `family_members`
--
CREATE TABLE IF NOT EXISTS `family_members` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`member_id` int(11) DEFAULT NULL,
`birth_date` date DEFAULT NULL,
`link_id` int(11) DEFAULT NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=28 ;
--
-- Structure de la table `games`
--
CREATE TABLE IF NOT EXISTS `games` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` tinytext,
`reference` tinytext,
`maker` tinytext,
`category` tinytext,
`comments` blob,
`maker_info` tinytext,
`content_inventory` blob,
`aquisition_date` date NOT NULL DEFAULT '0000-00-00',
`price` int(11) DEFAULT NULL,
`players_min` int(11) DEFAULT NULL,
`players_max` int(11) DEFAULT NULL,
`age_min` int(11) DEFAULT NULL,
`age_max` int(11) DEFAULT NULL,
`game_type` tinytext,
`esar_category_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=429 ;
--
-- Structure de la table `loans`
--
CREATE TABLE IF NOT EXISTS `loans` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`game_id` int(11) DEFAULT NULL,
`member_id` int(11) DEFAULT NULL,
`start_date` date DEFAULT NULL,
`end_date` date DEFAULT NULL,
`is_back` tinyint(4) NOT NULL DEFAULT '0',
`reglera_deprec` tinytext,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=579 ;
--
-- Structure de la table `medias`
--
CREATE TABLE IF NOT EXISTS `medias` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(255) DEFAULT NULL,
`media_type_id` int(11) NOT NULL,
`game_id` int(11) NOT NULL,
`file` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Structure de la table `media_types`
--
CREATE TABLE IF NOT EXISTS `media_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(255) DEFAULT NULL,
`mime_type` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- Contenu de la table `media_types`
--
INSERT INTO `media_types` (`id`, `description`, `mime_type`) VALUES
(1, 'Image PNG', 'image/png'),
(2, 'Image GIF', 'image/gif'),
(3, 'Image JPG', 'image/jpg'),
(4, 'Fichier PDF', 'application/pdf');
-- --------------------------------------------------------
--
-- Structure de la table `members`
--
CREATE TABLE IF NOT EXISTS `members` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`lastname` tinytext,
`firstname` tinytext,
`birth_date` date DEFAULT NULL,
`address` tinytext,
`po_town` tinytext,
`home_phone` tinytext,
`work_phone` tinytext,
`mobile_phone` tinytext,
`fax_phone` tinytext,
`comments` text,
`member_ref` int(11) DEFAULT NULL,
`deposit` tinyint(1) NOT NULL DEFAULT '0',
`deposit_expiration_date` date DEFAULT NULL,
`email` tinytext,
`newsletter` tinyint(1) DEFAULT NULL,
`other_members` longtext,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=132 ;
--
-- Structure de la table `membership_types`
--
CREATE TABLE IF NOT EXISTS `membership_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text,
`price` float(7,2) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
--
-- Contenu de la table `membership_types`
--
INSERT INTO `membership_types` (`id`, `name`, `description`, `price`, `created_at`, `updated_at`) VALUES
(1, 'Standard', 'Adhésion standard - à modifier.', 40.00, now(), now());
--
-- Structure de la table `payment_methods`
--
CREATE TABLE IF NOT EXISTS `payment_methods` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) DEFAULT NULL,
`description` text,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_payment_methods_on_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Contenu de la table `payment_methods`
--
INSERT INTO `payment_methods` (`id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'Chèque', 'Chèque à  l''ordre de la ludothèque - Merci', now(), now()),
(2, 'Espèces', NULL, now(), now());
-- --------------------------------------------------------
--
-- Structure de la table `roles`
--
CREATE TABLE IF NOT EXISTS `roles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
`description` text,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_roles_on_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
--
-- Contenu de la table `roles`
--
INSERT INTO `roles` (`id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'Gestion des roles', now(), now()),
(2, 'games', 'Gestion des jeux', now(), now()),
(3, 'members', 'Gestion des adhérents', now(), now());
--
-- Structure de la table `schema_migrations`
--
CREATE TABLE IF NOT EXISTS `schema_migrations` (
`version` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
UNIQUE KEY `unique_schema_migrations` (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contenu de la table `schema_migrations`
--
INSERT INTO `schema_migrations` (`version`) VALUES
('201511241849');
--
-- Structure de la table `subscriptions`
--
CREATE TABLE IF NOT EXISTS `subscriptions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`member_id` int(11) NOT NULL,
`membership_type_id` int(11) NOT NULL,
`payment_method_id` int(11) NOT NULL,
`credit` tinyint(1) NOT NULL DEFAULT '0',
`price` float(5,2) NOT NULL DEFAULT '0.00',
`comments` text,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `index_member_sub_on_membership_type_id` (`membership_type_id`),
KEY `index_member_sub_on_payment_method_id` (`payment_method_id`),
KEY `index_member_sub_on_member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=131 ;
--
-- Structure de la table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) DEFAULT NULL,
`password_digest` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_users_on_name` (`name`),
UNIQUE KEY `index_users_on_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Contenu de la table `users`
--
INSERT INTO `users` (`id`, `name`, `password_digest`, `email`, `active`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'luef5C4XumqIs', 'utilisateur@desactiver.com', 1, now(), now());
-- --------------------------------------------------------
--
-- Structure de la table `user_roles`
--
CREATE TABLE IF NOT EXISTS `user_roles` (
`user_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
UNIQUE KEY `index_user_roles_uk` (`user_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contenu de la table `user_roles`
--
INSERT INTO `user_roles` (`user_id`, `role_id`, `created_at`) VALUES
(1, 1, now()),
(1, 2, now()),
(1, 3, now());
-- --------------------------------------------------------
--
-- Structure de la table `zzz_adherent`
--
CREATE TABLE IF NOT EXISTS `zzz_adherent` (
`id_adherent` int(11) NOT NULL AUTO_INCREMENT,
`nom` tinytext,
`prenom` tinytext,
`date_inscription` date DEFAULT NULL,
`date_naissance` date DEFAULT NULL,
`adresse` tinytext,
`cp_ville` tinytext,
`tel_maison` tinytext,
`tel_travail` tinytext,
`tel_mobile` tinytext,
`tel_fax` tinytext,
`commentaire` blob,
`num_adherent` int(11) DEFAULT NULL,
`adhesion` enum('Famille','Individuel','Nounou','Nounou+famille','Structure') DEFAULT NULL,
`membership_type_id` int(11) DEFAULT NULL,
`email` tinytext,
`newsletter` int(11) DEFAULT NULL,
`autres` longtext,
`caution` enum('Cheque','Espece','Aucune') DEFAULT NULL,
PRIMARY KEY (`id_adherent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=133 ;
--
-- Contraintes pour la table `subscriptions`
--
ALTER TABLE `subscriptions`
ADD CONSTRAINT `fk_member_sub_membership_type_id` FOREIGN KEY (`membership_type_id`) REFERENCES `membership_types` (`id`),
ADD CONSTRAINT `fk_member_sub_member_id` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`),
ADD CONSTRAINT `fk_member_sub_payment_method_id` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`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 */;
alter table subscriptions drop foreign key fk_member_sub_member_id;
alter table subscriptions add CONSTRAINT `fk_member_sub_member_id` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`);
insert into schema_migrations values (201512100649);
CREATE TABLE `reservations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`game_id` int(11) DEFAULT NULL,
`member_id` int(11) DEFAULT NULL,
`reservation_date` date DEFAULT NULL,
`available` int(1) NOT NULL DEFAULT '0',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO schema_migrations VALUES ('201512180630');
-- for the games
update games set name = replace(name, 'É', 'É');
update games set name = replace(name, 'È', 'È');
update games set name = replace(name, 'À', 'À');
update games set name = replace(name, 'é', 'é');
update games set name = replace(name, 'ÃŽ', 'Î');
update games set name = replace(name, 'Ê', 'Ê');
update games set name = replace(name, 'Ô', 'Ô');
update games set name = replace(name, 'Ä', 'ä');
update games set name = replace(name, 'OÙ', 'Ù');
update games set name = replace(name, 'Ï', 'Ï');
update games set name = replace(name, 'Ö', 'ö');
update members set lastname = replace( lastname, 'É', 'É');
update members set firstname = replace( firstname, 'É', 'É');
update members set firstname = replace( firstname, 'é', 'é');
update members set po_town = replace( po_town, 'è', 'è');
update members set po_town = replace( po_town, 'É', 'É');
update members set other_members = replace( other_members, 'É', 'É');
update members set other_members = replace( other_members, 'È', 'È');
update members set other_members = replace( other_members, 'é', 'é');
update members set other_members = replace( other_members, 'ô', 'ô');
update members set other_members = replace( other_members, 'ç', 'ç');
update members set firstname = replace( firstname, 'ç', 'ç');
update members set address = replace( address, 'ë', 'ë');
update members set address = replace( address, 'é', 'é');
update members set firstname = replace( firstname, 'è', 'ê';
update members set firstname = replace( firstname, 'ë', 'æ');
update members set firstname = replace( firstname, 'ë', 'ë');
update members set address = replace( address, 'ô', 'ô');
update members set address = replace( address, 'ê', 'ê');
update members set address = replace( address, 'É', 'É');
update members set address = replace( address, 'è', 'è');
update members set po_town = replace( po_town, 'â', 'â');
update members set other_members = replace( other_members, 'ë', 'ë');
update members set other_members = replace( other_members, 'Ç', 'Ç');
update members set other_members = replace( other_members, 'è', 'è');
update members set other_members = replace( other_members, 'î', 'î');
update members set other_members = replace( other_members, 'ï', 'ï');
insert into schema_migrations values ('201512271652');
CREATE TABLE IF NOT EXISTS `sessions` (
`session_key` varchar(32) NOT NULL,
`session_data` text,
`session_expires` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `sessions`
ADD PRIMARY KEY (`session_key`);
INSERT INTO schema_migrations VALUES ('201601081120');
ALTER TABLE `bank_operations` ADD KEY `move_id_idx` (`move_id`);
ALTER TABLE `bank_operations` CHANGE `move_id` `move_id` INT(11) NULL DEFAULT NULL;
update bank_operations set move_id = NULL where move_id = 0;
ALTER TABLE `bank_operations` ADD FOREIGN KEY (`move_id`) REFERENCES `ludotheque`.`moves`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
INSERT INTO schema_migrations values ('201601301833');
CREATE TABLE IF NOT EXISTS `checkbooks` (
`id` int(11) NOT NULL,
`name` varchar(128) NOT NULL,
`num_start` int(11) NOT NULL,
`num_end` int(11) NOT NULL,
`num_length` int(11) NOT NULL,
`account_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `checkbooks` ADD PRIMARY KEY (`id`);
ALTER TABLE `checkbooks` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT:;
CREATE TABLE IF NOT EXISTS `checks` (
`id` varchar(16) NOT NULL,
`checkbook_id` int(11) NOT NULL,
`move_id` int(11) DEFAULT NULL,
`is_canceled` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `checks`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `move_id` (`move_id`), ADD KEY `checkbook_id` (`checkbook_id`);
ALTER TABLE `checks`
ADD CONSTRAINT `checks_ibfk_1` FOREIGN KEY (`checkbook_id`) REFERENCES `checkbooks` (`id`),
ADD CONSTRAINT `checks_ibfk_2` FOREIGN KEY (`move_id`) REFERENCES `moves` (`id`);
INSERT INTO schema_migrations VALUES ('201601310006');
ALTER TABLE `members` ADD `account_id` INT NULL DEFAULT NULL AFTER `other_members`, ADD INDEX (`account_id`) ;
ALTER TABLE `members` ADD FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
INSERT INTO schema_migrations values ('201602031718');
......@@ -14,6 +14,7 @@ class Game extends Record {
public static $table = "lud_games";
public function __construct($id = 0) {
$this->table = "lud_games";
if (!$this->id) {
$this->id = $id;
}
......
......@@ -11,6 +11,7 @@ class Loan extends Record {
public function __construct($id = 0)
{
$this->table = "lud_loans";
if (!$this->id) {
$this->id = $id;
}
......
......@@ -6,6 +6,7 @@ class Membership_Type extends Record {
public static $table = "lud_membership_types";
public function __construct($id = 0) {
$this->table = "lud_membership_types";
if (!$this->id) {
$this->id = $id;
}
......
......@@ -6,6 +6,7 @@ class Payment_Method extends Record {
public static $table = "lud_payment_methods";
public function __construct($id = 0) {
$this->table = "lud_payment_methods";
if (!$this->id) {
$this->id = $id;
}
......
......@@ -10,6 +10,7 @@ class Reservation extends Record {
public function __construct($id = 0)
{
$this->table = "lud_reservations";
if (!$this->id) {
$this->id = $id;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment