Lines 3518-3523
CREATE TABLE discharges (
Link Here
|
3518 |
CONSTRAINT borrower_discharges_ibfk1 FOREIGN KEY (borrower) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE |
3518 |
CONSTRAINT borrower_discharges_ibfk1 FOREIGN KEY (borrower) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE |
3519 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
3519 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
3520 |
|
3520 |
|
|
|
3521 |
-- |
3522 |
-- Table structure for table 'clubs' |
3523 |
-- |
3524 |
|
3525 |
DROP TABLE IF EXISTS clubs; |
3526 |
CREATE TABLE IF NOT EXISTS clubs ( |
3527 |
id int(11) NOT NULL AUTO_INCREMENT, |
3528 |
club_template_id int(11) NOT NULL, |
3529 |
`name` tinytext NOT NULL, |
3530 |
description text, |
3531 |
date_start date DEFAULT NULL, |
3532 |
date_end date DEFAULT NULL, |
3533 |
branchcode varchar(11) DEFAULT NULL, |
3534 |
date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
3535 |
date_updated timestamp NULL DEFAULT NULL, |
3536 |
PRIMARY KEY (id), |
3537 |
KEY club_template_id (club_template_id), |
3538 |
KEY branchcode (branchcode) |
3539 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
3540 |
|
3541 |
-- -------------------------------------------------------- |
3542 |
|
3543 |
-- |
3544 |
-- Table structure for table 'club_enrollments' |
3545 |
-- |
3546 |
|
3547 |
DROP TABLE IF EXISTS club_enrollments; |
3548 |
CREATE TABLE IF NOT EXISTS club_enrollments ( |
3549 |
id int(11) NOT NULL AUTO_INCREMENT, |
3550 |
club_id int(11) NOT NULL, |
3551 |
borrowernumber int(11) NOT NULL, |
3552 |
date_enrolled timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
3553 |
date_canceled timestamp NULL DEFAULT NULL, |
3554 |
date_created timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', |
3555 |
date_updated timestamp NULL DEFAULT NULL, |
3556 |
branchcode varchar(11) DEFAULT NULL, |
3557 |
PRIMARY KEY (id), |
3558 |
KEY club_id (club_id), |
3559 |
KEY borrowernumber (borrowernumber), |
3560 |
KEY branchcode (branchcode) |
3561 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
3562 |
|
3563 |
-- -------------------------------------------------------- |
3564 |
|
3565 |
-- |
3566 |
-- Table structure for table 'club_enrollment_fields' |
3567 |
-- |
3568 |
|
3569 |
DROP TABLE IF EXISTS club_enrollment_fields; |
3570 |
CREATE TABLE IF NOT EXISTS club_enrollment_fields ( |
3571 |
id int(11) NOT NULL AUTO_INCREMENT, |
3572 |
club_enrollment_id int(11) NOT NULL, |
3573 |
club_template_enrollment_field_id int(11) NOT NULL, |
3574 |
`value` text NOT NULL, |
3575 |
PRIMARY KEY (id), |
3576 |
KEY club_enrollment_id (club_enrollment_id), |
3577 |
KEY club_template_enrollment_field_id (club_template_enrollment_field_id) |
3578 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
3579 |
|
3580 |
-- -------------------------------------------------------- |
3581 |
|
3582 |
-- |
3583 |
-- Table structure for table 'club_fields' |
3584 |
-- |
3585 |
|
3586 |
DROP TABLE IF EXISTS club_fields; |
3587 |
CREATE TABLE IF NOT EXISTS club_fields ( |
3588 |
id int(11) NOT NULL AUTO_INCREMENT, |
3589 |
club_template_field_id int(11) NOT NULL, |
3590 |
club_id int(11) NOT NULL, |
3591 |
`value` text, |
3592 |
PRIMARY KEY (id), |
3593 |
KEY club_template_field_id (club_template_field_id), |
3594 |
KEY club_id (club_id) |
3595 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
3596 |
|
3597 |
-- -------------------------------------------------------- |
3598 |
|
3599 |
-- |
3600 |
-- Table structure for table 'club_templates' |
3601 |
-- |
3602 |
|
3603 |
DROP TABLE IF EXISTS club_templates; |
3604 |
CREATE TABLE IF NOT EXISTS club_templates ( |
3605 |
id int(11) NOT NULL AUTO_INCREMENT, |
3606 |
`name` tinytext NOT NULL, |
3607 |
description text, |
3608 |
is_enrollable_from_opac tinyint(1) NOT NULL DEFAULT '0', |
3609 |
is_email_required tinyint(1) NOT NULL DEFAULT '0', |
3610 |
branchcode varchar(10) DEFAULT NULL, |
3611 |
date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
3612 |
date_updated timestamp NULL DEFAULT NULL, |
3613 |
is_deletable tinyint(1) NOT NULL DEFAULT '1', |
3614 |
PRIMARY KEY (id), |
3615 |
KEY branchcode (branchcode) |
3616 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
3617 |
|
3618 |
-- -------------------------------------------------------- |
3619 |
|
3620 |
-- |
3621 |
-- Table structure for table 'club_template_enrollment_fields' |
3622 |
-- |
3623 |
|
3624 |
DROP TABLE IF EXISTS club_template_enrollment_fields; |
3625 |
CREATE TABLE IF NOT EXISTS club_template_enrollment_fields ( |
3626 |
id int(11) NOT NULL AUTO_INCREMENT, |
3627 |
club_template_id int(11) NOT NULL, |
3628 |
`name` tinytext NOT NULL, |
3629 |
description text, |
3630 |
authorised_value_category varchar(16) DEFAULT NULL, |
3631 |
PRIMARY KEY (id), |
3632 |
KEY club_template_id (club_template_id) |
3633 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
3634 |
|
3635 |
-- -------------------------------------------------------- |
3636 |
|
3637 |
-- |
3638 |
-- Table structure for table 'club_template_fields' |
3639 |
-- |
3640 |
|
3641 |
DROP TABLE IF EXISTS club_template_fields; |
3642 |
CREATE TABLE IF NOT EXISTS club_template_fields ( |
3643 |
id int(11) NOT NULL AUTO_INCREMENT, |
3644 |
club_template_id int(11) NOT NULL, |
3645 |
`name` tinytext NOT NULL, |
3646 |
description text, |
3647 |
authorised_value_category varchar(16) DEFAULT NULL, |
3648 |
PRIMARY KEY (id), |
3649 |
KEY club_template_id (club_template_id) |
3650 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
3651 |
|
3652 |
-- |
3653 |
-- Constraints for table `clubs` |
3654 |
-- |
3655 |
ALTER TABLE `clubs` |
3656 |
ADD CONSTRAINT clubs_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE, |
3657 |
ADD CONSTRAINT clubs_ibfk_2 FOREIGN KEY (branchcode) REFERENCES branches (branchcode); |
3658 |
|
3659 |
-- |
3660 |
-- Constraints for table `club_enrollments` |
3661 |
-- |
3662 |
ALTER TABLE `club_enrollments` |
3663 |
ADD CONSTRAINT club_enrollments_ibfk_1 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE, |
3664 |
ADD CONSTRAINT club_enrollments_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE, |
3665 |
ADD CONSTRAINT club_enrollments_ibfk_3 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE SET NULL ON UPDATE CASCADE; |
3666 |
|
3667 |
-- |
3668 |
-- Constraints for table `club_enrollment_fields` |
3669 |
-- |
3670 |
ALTER TABLE `club_enrollment_fields` |
3671 |
ADD CONSTRAINT club_enrollment_fields_ibfk_1 FOREIGN KEY (club_enrollment_id) REFERENCES club_enrollments (id) ON DELETE CASCADE ON UPDATE CASCADE, |
3672 |
ADD CONSTRAINT club_enrollment_fields_ibfk_2 FOREIGN KEY (club_template_enrollment_field_id) REFERENCES club_template_enrollment_fields (id) ON DELETE CASCADE ON UPDATE CASCADE; |
3673 |
|
3674 |
-- |
3675 |
-- Constraints for table `club_fields` |
3676 |
-- |
3677 |
ALTER TABLE `club_fields` |
3678 |
ADD CONSTRAINT club_fields_ibfk_3 FOREIGN KEY (club_template_field_id) REFERENCES club_template_fields (id) ON DELETE CASCADE ON UPDATE CASCADE, |
3679 |
ADD CONSTRAINT club_fields_ibfk_4 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE; |
3680 |
|
3681 |
-- |
3682 |
-- Constraints for table `club_templates` |
3683 |
-- |
3684 |
ALTER TABLE `club_templates` |
3685 |
ADD CONSTRAINT club_templates_ibfk_1 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE SET NULL ON UPDATE CASCADE; |
3686 |
|
3687 |
-- |
3688 |
-- Constraints for table `club_template_enrollment_fields` |
3689 |
-- |
3690 |
ALTER TABLE `club_template_enrollment_fields` |
3691 |
ADD CONSTRAINT club_template_enrollment_fields_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE; |
3692 |
|
3693 |
-- |
3694 |
-- Constraints for table `club_template_fields` |
3695 |
-- |
3696 |
ALTER TABLE `club_template_fields` |
3697 |
ADD CONSTRAINT club_template_fields_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE; |
3698 |
|
3521 |
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; |
3699 |
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; |
3522 |
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; |
3700 |
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; |
3523 |
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; |
3701 |
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; |