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