Sfoglia il codice sorgente

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

L. Dolio Durant 6 anni fa
parent
commit
08b4167a70
1 ha cambiato i file con 12 aggiunte e 15 eliminazioni
  1. 12
    15
      src/main/resources/schema-h2.sql

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

@@ -2,24 +2,20 @@ DROP TABLE IF EXISTS people;
2 2
 
3 3
 CREATE TABLE people (
4 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 8
   birthday DATE DEFAULT NULL,
9
-  home_id SMALLINT DEFAULT NULL,
9
+  home_id INT DEFAULT NULL,
10 10
   PRIMARY KEY (id));
11 11
 
12
-  ALTER TABLE people
13
-  ADD FOREIGN KEY (home_id)
14
-  REFERENCES homes(id);
15
-
16 12
 
17 13
 DROP TABLE IF EXISTS homes;
18 14
 
19 15
 CREATE TABLE homes (
20 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 19
   PRIMARY KEY (id)
24 20
 );
25 21
 
@@ -27,13 +23,14 @@ DROP TABLE IF EXISTS movies;
27 23
 
28 24
 CREATE TABLE movies (
29 25
   id INT PRIMARY KEY AUTO_INCREMENT,
30
-  title VARCHAR2(100) NOT NULL UNIQUE,
26
+  title VARCHAR(100) NOT NULL UNIQUE,
31 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 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;