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