Browse Source

debugged .sql file to make it compatible with Mysql instead of H2

L. Dolio Durant 6 years ago
parent
commit
08b4167a70
1 changed files with 12 additions and 15 deletions
  1. 12
    15
      src/main/resources/schema-h2.sql

+ 12
- 15
src/main/resources/schema-h2.sql View File

2
 
2
 
3
 CREATE TABLE people (
3
 CREATE TABLE people (
4
   id INT NOT NULL AUTO_INCREMENT,
4
   id INT NOT NULL AUTO_INCREMENT,
5
-  first_name VARCHAR2(255) NOT NULL DEFAULT '',
6
-  last_name VARCHAR2(255) NOT NULL DEFAULT '',
7
-  mobile VARCHAR2(20),
5
+  first_name VARCHAR(255) NOT NULL DEFAULT '',
6
+  last_name VARCHAR(255) NOT NULL DEFAULT '',
7
+  mobile VARCHAR(20),
8
   birthday DATE DEFAULT NULL,
8
   birthday DATE DEFAULT NULL,
9
-  home_id SMALLINT DEFAULT NULL,
9
+  home_id INT DEFAULT NULL,
10
   PRIMARY KEY (id));
10
   PRIMARY KEY (id));
11
 
11
 
12
-  ALTER TABLE people
13
-  ADD FOREIGN KEY (home_id)
14
-  REFERENCES homes(id);
15
-
16
 
12
 
17
 DROP TABLE IF EXISTS homes;
13
 DROP TABLE IF EXISTS homes;
18
 
14
 
19
 CREATE TABLE homes (
15
 CREATE TABLE homes (
20
   id INT NOT NULL AUTO_INCREMENT,
16
   id INT NOT NULL AUTO_INCREMENT,
21
-  address VARCHAR2(255) NOT NULL DEFAULT '',
22
-  homenumber VARCHAR2(255) NOT NULL DEFAULT '',
17
+  address VARCHAR(255) NOT NULL DEFAULT '',
18
+  homenumber VARCHAR(255) NOT NULL DEFAULT '',
23
   PRIMARY KEY (id)
19
   PRIMARY KEY (id)
24
 );
20
 );
25
 
21
 
27
 
23
 
28
 CREATE TABLE movies (
24
 CREATE TABLE movies (
29
   id INT PRIMARY KEY AUTO_INCREMENT,
25
   id INT PRIMARY KEY AUTO_INCREMENT,
30
-  title VARCHAR2(100) NOT NULL UNIQUE,
26
+  title VARCHAR(100) NOT NULL UNIQUE,
31
   runtime SMALLINT NOT NULL,
27
   runtime SMALLINT NOT NULL,
32
-  genre VARCHAR2(50),
33
-  imdb_score NUMBER(10,1),
28
+  genre VARCHAR(50),
29
+  imdb_score DECIMAL(10,1),
34
   rating VARCHAR(10)
30
   rating VARCHAR(10)
35
 );
31
 );
36
 
32
 
37
-DROP SEQUENCE hibernate_sequence;
33
+  ALTER TABLE people
34
+  ADD FOREIGN KEY (home_id)
35
+  REFERENCES homes(id);
38
 
36
 
39
-CREATE SEQUENCE hibernate_sequence;