+--
+-- Table structure for table 'discharges'
+--
+
+DROP TABLE IF EXISTS discharges;
+CREATE TABLE discharges (
+ discharge_id int(11) NOT NULL AUTO_INCREMENT,
+ borrower int(11) DEFAULT NULL,
+ needed timestamp NULL DEFAULT NULL,
+ validated timestamp NULL DEFAULT NULL,
+ PRIMARY KEY (discharge_id),
+ KEY borrower_discharges_ibfk1 (borrower),
+ CONSTRAINT borrower_discharges_ibfk1 FOREIGN KEY (borrower) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table additional_fields
+-- This table add the ability to add new fields for a record
+--
+
+CREATE TABLE `additional_fields` (
+ `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
+ `tablename` varchar(255) NOT NULL DEFAULT '', -- tablename of the new field
+ `name` varchar(255) NOT NULL DEFAULT '', -- name of the field
+ `authorised_value_category` varchar(16) NOT NULL DEFAULT '', -- is an authorised value category
+ `marcfield` varchar(16) NOT NULL DEFAULT '', -- contains the marc field to copied into the record
+ `searchable` tinyint(1) NOT NULL DEFAULT '0', -- is the field searchable?
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `fields_uniq` (`tablename`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table additional_field_values
+-- This table store values for additional fields
+--
+
+CREATE TABLE `additional_field_values` (
+ `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
+ `field_id` int(11) NOT NULL, -- foreign key references additional_fields(id)
+ `record_id` int(11) NOT NULL, -- record_id
+ `value` varchar(255) NOT NULL DEFAULT '', -- value for this field
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `field_record` (`field_id`,`record_id`),
+ CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table 'localization'
+--
+
+DROP TABLE IF EXISTS localization;
+CREATE TABLE `localization` (
+ localization_id int(11) NOT NULL AUTO_INCREMENT,
+ entity varchar(16) COLLATE utf8_unicode_ci NOT NULL,
+ code varchar(64) COLLATE utf8_unicode_ci NOT NULL,
+ lang varchar(25) COLLATE utf8_unicode_ci NOT NULL, -- could be a foreign key
+ translation text COLLATE utf8_unicode_ci,
+ PRIMARY KEY (localization_id),
+ UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table 'audio_alerts'
+--
+
+DROP TABLE IF EXISTS audio_alerts;
+CREATE TABLE audio_alerts (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ precedence smallint(5) unsigned NOT NULL,
+ selector varchar(255) NOT NULL,
+ sound varchar(255) NOT NULL,
+ PRIMARY KEY (id),
+ KEY precedence (precedence)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table 'edifact_ean'
+--
+
+DROP TABLE IF EXISTS edifact_ean;
+CREATE TABLE IF NOT EXISTS edifact_ean (
+ ee_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ description VARCHAR(128) NULL DEFAULT NULL,
+ branchcode VARCHAR(10) NOT NULL REFERENCES branches (branchcode),
+ ean VARCHAR(15) NOT NULL,
+ id_code_qualifier VARCHAR(3) NOT NULL DEFAULT '14',
+ CONSTRAINT efk_branchcode FOREIGN KEY ( branchcode ) REFERENCES branches ( branchcode )
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+