-
Notifications
You must be signed in to change notification settings - Fork 1
/
dump.sql
40 lines (32 loc) · 1.13 KB
/
dump.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- book
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `book`;
CREATE TABLE `book`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`isbn` VARCHAR(24) NOT NULL,
`author_id` INTEGER NOT NULL,
PRIMARY KEY (`id`),
INDEX `book_fi_ea464c` (`author_id`),
CONSTRAINT `book_fk_ea464c`
FOREIGN KEY (`author_id`)
REFERENCES `author` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- author
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `author`;
CREATE TABLE `author`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(128) NOT NULL,
`last_name` VARCHAR(128) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;