@dbml/cli 3.3.0 → 3.4.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +36 -0
- package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
- package/__test__/dbml2sql/filename --oracle --out-file/expect-out-files/schema.sql +57 -0
- package/__test__/dbml2sql/filename --oracle --out-file/in-files/schema.dbml +71 -0
- package/__test__/dbml2sql/filename --oracle --out-file/options.json +8 -0
- package/__test__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +61 -0
- package/__test__/dbml2sql/filename --oracle --out-file/stdout.txt +1 -0
- package/__test__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filename --oracle stdout/in-files/schema.dbml +71 -0
- package/__test__/dbml2sql/filename --oracle stdout/options.json +6 -0
- package/__test__/dbml2sql/filename --oracle stdout/stdout.txt +58 -0
- package/__test__/dbml2sql/filename --out-file/dbml-error.log +36 -0
- package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/expect-out-files/schema.sql +168 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/in-files/business.dbml +40 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/in-files/customer.dbml +39 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/in-files/inventory.dbml +61 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/options.json +10 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +172 -0
- package/__test__/dbml2sql/filenames --oracle --out-file/stdout.txt +1 -0
- package/__test__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
- package/__test__/dbml2sql/filenames --oracle stdout/in-files/business.dbml +40 -0
- package/__test__/dbml2sql/filenames --oracle stdout/in-files/customer.dbml +39 -0
- package/__test__/dbml2sql/filenames --oracle stdout/in-files/inventory.dbml +61 -0
- package/__test__/dbml2sql/filenames --oracle stdout/options.json +8 -0
- package/__test__/dbml2sql/filenames --oracle stdout/stdout.txt +171 -0
- package/__test__/dbml2sql/filenames --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +24 -0
- package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +2 -2
- package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +24 -0
- package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +2 -2
- package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +24 -0
- package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +2 -2
- package/__test__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
- package/__test__/dbml2sql/multiple_schema_oracle/expect-out-files/multiple_schema.out.sql +84 -0
- package/__test__/dbml2sql/multiple_schema_oracle/in-files/multiple_schema.in.dbml +45 -0
- package/__test__/dbml2sql/multiple_schema_oracle/options.json +8 -0
- package/__test__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +88 -0
- package/__test__/dbml2sql/multiple_schema_oracle/stdout.txt +1 -0
- package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +24 -0
- package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +2 -2
- package/__test__/dbml2sql/syntax-error/dbml-error.log +2158 -1074
- package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +51 -0
- package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filename --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +239 -0
- package/__test__/sql2dbml/filenames --mysql stdout/dbml-error.log +218 -0
- package/__test__/sql2dbml/filenames --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +24 -0
- package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +121 -0
- package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +104 -0
- package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +163 -32
- package/__test__/sql2dbml/syntax-error/dbml-error.log +2711 -1094
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +1990 -1130
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/stdout.txt +2 -1
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +1985 -1125
- package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/stdout.txt +2 -1
- package/bin/dbml-error.log +0 -0
- package/bin/dbml2sql.js +0 -0
- package/bin/sql2dbml.js +0 -0
- package/dbml-error.log +322 -258
- package/lib/cli/config.js +3 -0
- package/lib/cli/export.js +4 -3
- package/lib/cli/import.js +3 -3
- package/lib/cli/index.js +1 -1
- package/lib/cli/utils.js +9 -7
- package/package.json +3 -3
- package/src/cli/config.js +3 -0
- package/src/cli/export.js +9 -5
- package/src/cli/import.js +4 -5
- package/src/cli/index.js +1 -0
- package/src/cli/utils.js +5 -7
- package/yarn-error.log +0 -87
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
CREATE TABLE "staff" (
|
|
2
|
+
"id" int PRIMARY KEY,
|
|
3
|
+
"first_name" nvarchar2(255),
|
|
4
|
+
"last_name" nvarchar2(255),
|
|
5
|
+
"address_id" int,
|
|
6
|
+
"picture" blob,
|
|
7
|
+
"email" nvarchar2(255),
|
|
8
|
+
"store_id" int,
|
|
9
|
+
"active" number(1),
|
|
10
|
+
"user_name" nvarchar2(255),
|
|
11
|
+
"password" nvarchar2(255),
|
|
12
|
+
"last_update" timestamp
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
CREATE TABLE "store" (
|
|
16
|
+
"id" int PRIMARY KEY,
|
|
17
|
+
"manager_staff_id" int,
|
|
18
|
+
"address_id" int,
|
|
19
|
+
"last_update" timestamp
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE TABLE "payment" (
|
|
23
|
+
"id" int PRIMARY KEY,
|
|
24
|
+
"customer_id" int,
|
|
25
|
+
"staff_id" int,
|
|
26
|
+
"rental_id" int,
|
|
27
|
+
"amount" float,
|
|
28
|
+
"payment_date" date,
|
|
29
|
+
"last_update" timestamp
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE TABLE "rental" (
|
|
33
|
+
"id" int PRIMARY KEY,
|
|
34
|
+
"rental_date" date,
|
|
35
|
+
"inventory_id" int,
|
|
36
|
+
"customer_id" int,
|
|
37
|
+
"return_date" date,
|
|
38
|
+
"staff_id" int,
|
|
39
|
+
"last_update" timestamp
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
ALTER TABLE "staff" ADD FOREIGN KEY ("store_id") REFERENCES "store" ("id");
|
|
43
|
+
|
|
44
|
+
ALTER TABLE "store" ADD FOREIGN KEY ("manager_staff_id") REFERENCES "staff" ("id");
|
|
45
|
+
|
|
46
|
+
ALTER TABLE "payment" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id");
|
|
47
|
+
|
|
48
|
+
ALTER TABLE "payment" ADD FOREIGN KEY ("rental_id") REFERENCES "rental" ("id");
|
|
49
|
+
|
|
50
|
+
ALTER TABLE "rental" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id");
|
|
51
|
+
CREATE TABLE "country" (
|
|
52
|
+
"id" int PRIMARY KEY,
|
|
53
|
+
"country" nvarchar2(255),
|
|
54
|
+
"last_update" timestamp
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
CREATE TABLE "city" (
|
|
58
|
+
"id" int PRIMARY KEY,
|
|
59
|
+
"city" nvarchar2(255),
|
|
60
|
+
"country_id" int,
|
|
61
|
+
"last_update" timestamp
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
CREATE TABLE "address" (
|
|
65
|
+
"id" int PRIMARY KEY,
|
|
66
|
+
"address" nvarchar2(255),
|
|
67
|
+
"address2" nvarchar2(255),
|
|
68
|
+
"district" nvarchar2(255),
|
|
69
|
+
"city_id" int,
|
|
70
|
+
"postal_code" nvarchar2(255),
|
|
71
|
+
"phone" nvarchar2(255),
|
|
72
|
+
"last_update" timestamp
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
CREATE TABLE "customer" (
|
|
76
|
+
"id" int PRIMARY KEY,
|
|
77
|
+
"store_id" int,
|
|
78
|
+
"first_name" nvarchar2(255),
|
|
79
|
+
"last_name" nvarchar2(255),
|
|
80
|
+
"email" nvarchar2(255),
|
|
81
|
+
"address_id" int,
|
|
82
|
+
"active" number(1),
|
|
83
|
+
"create_Date" timestamp,
|
|
84
|
+
"last_update" timestamp
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
CREATE INDEX "IDX_CUSTOMER" ON "customer" ("id", "first_name");
|
|
88
|
+
|
|
89
|
+
ALTER TABLE "city" ADD FOREIGN KEY ("country_id") REFERENCES "country" ("id");
|
|
90
|
+
|
|
91
|
+
ALTER TABLE "address" ADD FOREIGN KEY ("city_id") REFERENCES "city" ("id");
|
|
92
|
+
|
|
93
|
+
ALTER TABLE "customer" ADD FOREIGN KEY ("address_id") REFERENCES "address" ("id");
|
|
94
|
+
CREATE TABLE "category" (
|
|
95
|
+
"id" int PRIMARY KEY,
|
|
96
|
+
"name" nvarchar2(255),
|
|
97
|
+
"last_update" timestamp
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
CREATE TABLE "film_category" (
|
|
101
|
+
"id" int PRIMARY KEY,
|
|
102
|
+
"category_id" int,
|
|
103
|
+
"last_update" timestamp
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
CREATE TABLE "language" (
|
|
107
|
+
"id" int PRIMARY KEY,
|
|
108
|
+
"name" nvarchar2(255),
|
|
109
|
+
"last_update" timestamp
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
CREATE TABLE "film_text" (
|
|
113
|
+
"id" int PRIMARY KEY,
|
|
114
|
+
"film_id" int,
|
|
115
|
+
"title" nvarchar2(255),
|
|
116
|
+
"description" nclob
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
CREATE TABLE "actor" (
|
|
120
|
+
"id" int PRIMARY KEY,
|
|
121
|
+
"first_name" nvarchar2(255),
|
|
122
|
+
"last_name" nvarchar2(255),
|
|
123
|
+
"last_update" timestamp
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
CREATE TABLE "film" (
|
|
127
|
+
"id" int PRIMARY KEY,
|
|
128
|
+
"title" nvarchar2(255),
|
|
129
|
+
"description" nclob,
|
|
130
|
+
"releaase_year" int,
|
|
131
|
+
"language_id" int,
|
|
132
|
+
"original_language_id" int,
|
|
133
|
+
"rental_duration" int,
|
|
134
|
+
"rental_rate" float,
|
|
135
|
+
"length" int,
|
|
136
|
+
"replacement_cost" float,
|
|
137
|
+
"rating" nvarchar2(255),
|
|
138
|
+
"special_feature" nvarchar2(255),
|
|
139
|
+
"last_update" timestamp
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
CREATE TABLE "film_actor" (
|
|
143
|
+
"id" int PRIMARY KEY,
|
|
144
|
+
"film_id" int,
|
|
145
|
+
"actor_id" int,
|
|
146
|
+
"last_update" timestamp
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
CREATE TABLE "inventory" (
|
|
150
|
+
"id" int PRIMARY KEY,
|
|
151
|
+
"film_id" int,
|
|
152
|
+
"store_id" int,
|
|
153
|
+
"last_update" timestamp
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
ALTER TABLE "film_category" ADD FOREIGN KEY ("category_id") REFERENCES "category" ("id");
|
|
157
|
+
|
|
158
|
+
ALTER TABLE "film_text" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
|
|
159
|
+
|
|
160
|
+
ALTER TABLE "film" ADD FOREIGN KEY ("language_id") REFERENCES "language" ("id");
|
|
161
|
+
|
|
162
|
+
ALTER TABLE "film" ADD FOREIGN KEY ("original_language_id") REFERENCES "language" ("id");
|
|
163
|
+
|
|
164
|
+
ALTER TABLE "film_actor" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
|
|
165
|
+
|
|
166
|
+
ALTER TABLE "film_actor" ADD FOREIGN KEY ("actor_id") REFERENCES "actor" ("id");
|
|
167
|
+
|
|
168
|
+
ALTER TABLE "inventory" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Table staff {
|
|
2
|
+
id int [pk]
|
|
3
|
+
first_name nvarchar2(255)
|
|
4
|
+
last_name nvarchar2(255)
|
|
5
|
+
address_id int
|
|
6
|
+
picture blob
|
|
7
|
+
email nvarchar2(255)
|
|
8
|
+
store_id int [ref: > store.id]
|
|
9
|
+
active number(1)
|
|
10
|
+
user_name nvarchar2(255)
|
|
11
|
+
password nvarchar2(255)
|
|
12
|
+
last_update timestamp
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Table store {
|
|
16
|
+
id int [pk]
|
|
17
|
+
manager_staff_id int [ref: > staff.id]
|
|
18
|
+
address_id int
|
|
19
|
+
last_update timestamp
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
table payment {
|
|
23
|
+
id int [pk]
|
|
24
|
+
customer_id int
|
|
25
|
+
staff_id int [ref: > staff.id]
|
|
26
|
+
rental_id int [ref: > rental.id]
|
|
27
|
+
amount float
|
|
28
|
+
payment_date date
|
|
29
|
+
last_update timestamp
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Table rental {
|
|
33
|
+
id int [pk]
|
|
34
|
+
rental_date date
|
|
35
|
+
inventory_id int
|
|
36
|
+
customer_id int
|
|
37
|
+
return_date date
|
|
38
|
+
staff_id int [ref: > staff.id]
|
|
39
|
+
last_update timestamp
|
|
40
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Table country {
|
|
2
|
+
id int [pk]
|
|
3
|
+
country nvarchar2(255)
|
|
4
|
+
last_update timestamp
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
Table city {
|
|
8
|
+
id int [pk]
|
|
9
|
+
city nvarchar2(255)
|
|
10
|
+
country_id int [ref: > country.id]
|
|
11
|
+
last_update timestamp
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
Table address {
|
|
15
|
+
id int [pk]
|
|
16
|
+
address nvarchar2(255)
|
|
17
|
+
address2 nvarchar2(255)
|
|
18
|
+
district nvarchar2(255)
|
|
19
|
+
city_id int [ref: > city.id]
|
|
20
|
+
postal_code nvarchar2(255)
|
|
21
|
+
phone nvarchar2(255)
|
|
22
|
+
last_update timestamp
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Table customer {
|
|
26
|
+
id int [pk]
|
|
27
|
+
store_id int
|
|
28
|
+
first_name nvarchar2(255)
|
|
29
|
+
last_name nvarchar2(255)
|
|
30
|
+
email nvarchar2(255)
|
|
31
|
+
address_id int [ref: > address.id]
|
|
32
|
+
active number(1)
|
|
33
|
+
create_Date timestamp
|
|
34
|
+
last_update timestamp
|
|
35
|
+
|
|
36
|
+
Indexes {
|
|
37
|
+
(id, first_name) [type: btree, name: "IDX_CUSTOMER"]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Table category {
|
|
2
|
+
id int [pk]
|
|
3
|
+
name nvarchar2(255)
|
|
4
|
+
last_update timestamp
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
Table film_category {
|
|
8
|
+
id int [pk]
|
|
9
|
+
category_id int [ref: > category.id]
|
|
10
|
+
last_update timestamp
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Table language {
|
|
14
|
+
id int [pk]
|
|
15
|
+
name nvarchar2(255)
|
|
16
|
+
last_update timestamp
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Table film_text {
|
|
20
|
+
id int [pk]
|
|
21
|
+
film_id int [ref: > film.id]
|
|
22
|
+
title nvarchar2(255)
|
|
23
|
+
description nclob
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Table actor {
|
|
27
|
+
id int [pk]
|
|
28
|
+
first_name nvarchar2(255)
|
|
29
|
+
last_name nvarchar2(255)
|
|
30
|
+
last_update timestamp
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Table film {
|
|
34
|
+
id int [pk]
|
|
35
|
+
title nvarchar2(255)
|
|
36
|
+
description nclob
|
|
37
|
+
releaase_year int
|
|
38
|
+
language_id int [ref: > language.id]
|
|
39
|
+
original_language_id int [ref: > language.id]
|
|
40
|
+
rental_duration int
|
|
41
|
+
rental_rate float
|
|
42
|
+
length int
|
|
43
|
+
replacement_cost float
|
|
44
|
+
rating nvarchar2(255)
|
|
45
|
+
special_feature nvarchar2(255)
|
|
46
|
+
last_update timestamp
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Table film_actor {
|
|
50
|
+
id int [pk]
|
|
51
|
+
film_id int [ref: > film.id]
|
|
52
|
+
actor_id int [ref: > actor.id]
|
|
53
|
+
last_update timestamp
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Table inventory {
|
|
57
|
+
id int [pk]
|
|
58
|
+
film_id int [ref: > film.id]
|
|
59
|
+
store_id int
|
|
60
|
+
last_update timestamp
|
|
61
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
-- SQL dump generated using DBML (dbml.dbdiagram.io)
|
|
2
|
+
-- Database: Oracle
|
|
3
|
+
-- Generated at: 2024-04-11T04:18:15.790Z
|
|
4
|
+
|
|
5
|
+
CREATE TABLE "staff" (
|
|
6
|
+
"id" int PRIMARY KEY,
|
|
7
|
+
"first_name" nvarchar2(255),
|
|
8
|
+
"last_name" nvarchar2(255),
|
|
9
|
+
"address_id" int,
|
|
10
|
+
"picture" blob,
|
|
11
|
+
"email" nvarchar2(255),
|
|
12
|
+
"store_id" int,
|
|
13
|
+
"active" number(1),
|
|
14
|
+
"user_name" nvarchar2(255),
|
|
15
|
+
"password" nvarchar2(255),
|
|
16
|
+
"last_update" timestamp
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
CREATE TABLE "store" (
|
|
20
|
+
"id" int PRIMARY KEY,
|
|
21
|
+
"manager_staff_id" int,
|
|
22
|
+
"address_id" int,
|
|
23
|
+
"last_update" timestamp
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
CREATE TABLE "payment" (
|
|
27
|
+
"id" int PRIMARY KEY,
|
|
28
|
+
"customer_id" int,
|
|
29
|
+
"staff_id" int,
|
|
30
|
+
"rental_id" int,
|
|
31
|
+
"amount" float,
|
|
32
|
+
"payment_date" date,
|
|
33
|
+
"last_update" timestamp
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
CREATE TABLE "rental" (
|
|
37
|
+
"id" int PRIMARY KEY,
|
|
38
|
+
"rental_date" date,
|
|
39
|
+
"inventory_id" int,
|
|
40
|
+
"customer_id" int,
|
|
41
|
+
"return_date" date,
|
|
42
|
+
"staff_id" int,
|
|
43
|
+
"last_update" timestamp
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
ALTER TABLE "staff" ADD FOREIGN KEY ("store_id") REFERENCES "store" ("id");
|
|
47
|
+
|
|
48
|
+
ALTER TABLE "store" ADD FOREIGN KEY ("manager_staff_id") REFERENCES "staff" ("id");
|
|
49
|
+
|
|
50
|
+
ALTER TABLE "payment" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id");
|
|
51
|
+
|
|
52
|
+
ALTER TABLE "payment" ADD FOREIGN KEY ("rental_id") REFERENCES "rental" ("id");
|
|
53
|
+
|
|
54
|
+
ALTER TABLE "rental" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id");
|
|
55
|
+
CREATE TABLE "country" (
|
|
56
|
+
"id" int PRIMARY KEY,
|
|
57
|
+
"country" nvarchar2(255),
|
|
58
|
+
"last_update" timestamp
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
CREATE TABLE "city" (
|
|
62
|
+
"id" int PRIMARY KEY,
|
|
63
|
+
"city" nvarchar2(255),
|
|
64
|
+
"country_id" int,
|
|
65
|
+
"last_update" timestamp
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
CREATE TABLE "address" (
|
|
69
|
+
"id" int PRIMARY KEY,
|
|
70
|
+
"address" nvarchar2(255),
|
|
71
|
+
"address2" nvarchar2(255),
|
|
72
|
+
"district" nvarchar2(255),
|
|
73
|
+
"city_id" int,
|
|
74
|
+
"postal_code" nvarchar2(255),
|
|
75
|
+
"phone" nvarchar2(255),
|
|
76
|
+
"last_update" timestamp
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
CREATE TABLE "customer" (
|
|
80
|
+
"id" int PRIMARY KEY,
|
|
81
|
+
"store_id" int,
|
|
82
|
+
"first_name" nvarchar2(255),
|
|
83
|
+
"last_name" nvarchar2(255),
|
|
84
|
+
"email" nvarchar2(255),
|
|
85
|
+
"address_id" int,
|
|
86
|
+
"active" number(1),
|
|
87
|
+
"create_Date" timestamp,
|
|
88
|
+
"last_update" timestamp
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
CREATE INDEX "IDX_CUSTOMER" ON "customer" ("id", "first_name");
|
|
92
|
+
|
|
93
|
+
ALTER TABLE "city" ADD FOREIGN KEY ("country_id") REFERENCES "country" ("id");
|
|
94
|
+
|
|
95
|
+
ALTER TABLE "address" ADD FOREIGN KEY ("city_id") REFERENCES "city" ("id");
|
|
96
|
+
|
|
97
|
+
ALTER TABLE "customer" ADD FOREIGN KEY ("address_id") REFERENCES "address" ("id");
|
|
98
|
+
CREATE TABLE "category" (
|
|
99
|
+
"id" int PRIMARY KEY,
|
|
100
|
+
"name" nvarchar2(255),
|
|
101
|
+
"last_update" timestamp
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
CREATE TABLE "film_category" (
|
|
105
|
+
"id" int PRIMARY KEY,
|
|
106
|
+
"category_id" int,
|
|
107
|
+
"last_update" timestamp
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
CREATE TABLE "language" (
|
|
111
|
+
"id" int PRIMARY KEY,
|
|
112
|
+
"name" nvarchar2(255),
|
|
113
|
+
"last_update" timestamp
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
CREATE TABLE "film_text" (
|
|
117
|
+
"id" int PRIMARY KEY,
|
|
118
|
+
"film_id" int,
|
|
119
|
+
"title" nvarchar2(255),
|
|
120
|
+
"description" nclob
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
CREATE TABLE "actor" (
|
|
124
|
+
"id" int PRIMARY KEY,
|
|
125
|
+
"first_name" nvarchar2(255),
|
|
126
|
+
"last_name" nvarchar2(255),
|
|
127
|
+
"last_update" timestamp
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
CREATE TABLE "film" (
|
|
131
|
+
"id" int PRIMARY KEY,
|
|
132
|
+
"title" nvarchar2(255),
|
|
133
|
+
"description" nclob,
|
|
134
|
+
"releaase_year" int,
|
|
135
|
+
"language_id" int,
|
|
136
|
+
"original_language_id" int,
|
|
137
|
+
"rental_duration" int,
|
|
138
|
+
"rental_rate" float,
|
|
139
|
+
"length" int,
|
|
140
|
+
"replacement_cost" float,
|
|
141
|
+
"rating" nvarchar2(255),
|
|
142
|
+
"special_feature" nvarchar2(255),
|
|
143
|
+
"last_update" timestamp
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
CREATE TABLE "film_actor" (
|
|
147
|
+
"id" int PRIMARY KEY,
|
|
148
|
+
"film_id" int,
|
|
149
|
+
"actor_id" int,
|
|
150
|
+
"last_update" timestamp
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
CREATE TABLE "inventory" (
|
|
154
|
+
"id" int PRIMARY KEY,
|
|
155
|
+
"film_id" int,
|
|
156
|
+
"store_id" int,
|
|
157
|
+
"last_update" timestamp
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
ALTER TABLE "film_category" ADD FOREIGN KEY ("category_id") REFERENCES "category" ("id");
|
|
161
|
+
|
|
162
|
+
ALTER TABLE "film_text" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
|
|
163
|
+
|
|
164
|
+
ALTER TABLE "film" ADD FOREIGN KEY ("language_id") REFERENCES "language" ("id");
|
|
165
|
+
|
|
166
|
+
ALTER TABLE "film" ADD FOREIGN KEY ("original_language_id") REFERENCES "language" ("id");
|
|
167
|
+
|
|
168
|
+
ALTER TABLE "film_actor" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
|
|
169
|
+
|
|
170
|
+
ALTER TABLE "film_actor" ADD FOREIGN KEY ("actor_id") REFERENCES "actor" ("id");
|
|
171
|
+
|
|
172
|
+
ALTER TABLE "inventory" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
✔ Generated SQL dump file (Oracle): schema.sql
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Table staff {
|
|
2
|
+
id int [pk]
|
|
3
|
+
first_name nvarchar2(255)
|
|
4
|
+
last_name nvarchar2(255)
|
|
5
|
+
address_id int
|
|
6
|
+
picture blob
|
|
7
|
+
email nvarchar2(255)
|
|
8
|
+
store_id int [ref: > store.id]
|
|
9
|
+
active number(1)
|
|
10
|
+
user_name nvarchar2(255)
|
|
11
|
+
password nvarchar2(255)
|
|
12
|
+
last_update timestamp
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Table store {
|
|
16
|
+
id int [pk]
|
|
17
|
+
manager_staff_id int [ref: > staff.id]
|
|
18
|
+
address_id int
|
|
19
|
+
last_update timestamp
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
table payment {
|
|
23
|
+
id int [pk]
|
|
24
|
+
customer_id int
|
|
25
|
+
staff_id int [ref: > staff.id]
|
|
26
|
+
rental_id int [ref: > rental.id]
|
|
27
|
+
amount float
|
|
28
|
+
payment_date date
|
|
29
|
+
last_update timestamp
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Table rental {
|
|
33
|
+
id int [pk]
|
|
34
|
+
rental_date date
|
|
35
|
+
inventory_id int
|
|
36
|
+
customer_id int
|
|
37
|
+
return_date date
|
|
38
|
+
staff_id int [ref: > staff.id]
|
|
39
|
+
last_update timestamp
|
|
40
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Table country {
|
|
2
|
+
id int [pk]
|
|
3
|
+
country nvarchar2(255)
|
|
4
|
+
last_update timestamp
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
Table city {
|
|
8
|
+
id int [pk]
|
|
9
|
+
city nvarchar2(255)
|
|
10
|
+
country_id int [ref: > country.id]
|
|
11
|
+
last_update timestamp
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
Table address {
|
|
15
|
+
id int [pk]
|
|
16
|
+
address nvarchar2(255)
|
|
17
|
+
address2 nvarchar2(255)
|
|
18
|
+
district nvarchar2(255)
|
|
19
|
+
city_id int [ref: > city.id]
|
|
20
|
+
postal_code nvarchar2(255)
|
|
21
|
+
phone nvarchar2(255)
|
|
22
|
+
last_update timestamp
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Table customer {
|
|
26
|
+
id int [pk]
|
|
27
|
+
store_id int
|
|
28
|
+
first_name nvarchar2(255)
|
|
29
|
+
last_name nvarchar2(255)
|
|
30
|
+
email nvarchar2(255)
|
|
31
|
+
address_id int [ref: > address.id]
|
|
32
|
+
active number(1)
|
|
33
|
+
create_Date timestamp
|
|
34
|
+
last_update timestamp
|
|
35
|
+
|
|
36
|
+
Indexes {
|
|
37
|
+
(id, first_name) [type: btree, name: "IDX_CUSTOMER"]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Table category {
|
|
2
|
+
id int [pk]
|
|
3
|
+
name nvarchar2(255)
|
|
4
|
+
last_update timestamp
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
Table film_category {
|
|
8
|
+
id int [pk]
|
|
9
|
+
category_id int [ref: > category.id]
|
|
10
|
+
last_update timestamp
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Table language {
|
|
14
|
+
id int [pk]
|
|
15
|
+
name nvarchar2(255)
|
|
16
|
+
last_update timestamp
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Table film_text {
|
|
20
|
+
id int [pk]
|
|
21
|
+
film_id int [ref: > film.id]
|
|
22
|
+
title nvarchar2(255)
|
|
23
|
+
description nclob
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Table actor {
|
|
27
|
+
id int [pk]
|
|
28
|
+
first_name nvarchar2(255)
|
|
29
|
+
last_name nvarchar2(255)
|
|
30
|
+
last_update timestamp
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Table film {
|
|
34
|
+
id int [pk]
|
|
35
|
+
title nvarchar2(255)
|
|
36
|
+
description nclob
|
|
37
|
+
releaase_year int
|
|
38
|
+
language_id int [ref: > language.id]
|
|
39
|
+
original_language_id int [ref: > language.id]
|
|
40
|
+
rental_duration int
|
|
41
|
+
rental_rate float
|
|
42
|
+
length int
|
|
43
|
+
replacement_cost float
|
|
44
|
+
rating nvarchar2(255)
|
|
45
|
+
special_feature nvarchar2(255)
|
|
46
|
+
last_update timestamp
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Table film_actor {
|
|
50
|
+
id int [pk]
|
|
51
|
+
film_id int [ref: > film.id]
|
|
52
|
+
actor_id int [ref: > actor.id]
|
|
53
|
+
last_update timestamp
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Table inventory {
|
|
57
|
+
id int [pk]
|
|
58
|
+
film_id int [ref: > film.id]
|
|
59
|
+
store_id int
|
|
60
|
+
last_update timestamp
|
|
61
|
+
}
|