@dbml/cli 10.2.1-expose-diagnostic-filepath.0 → 11.0.0-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.
Files changed (90) hide show
  1. package/lib/index.js +151 -207
  2. package/package.json +5 -5
  3. package/__tests__/db2dbml/mssql/dbml-error.log +0 -55
  4. package/__tests__/db2dbml/mysql/dbml-error.log +0 -15
  5. package/__tests__/db2dbml/oracle/dbml-error.log +0 -70
  6. package/__tests__/db2dbml/postgres/dbml-error.log +0 -35
  7. package/__tests__/dbml2sql/filename --mysql --out-file/dbml-error.log +0 -0
  8. package/__tests__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +0 -65
  9. package/__tests__/dbml2sql/filename --mysql stdout/dbml-error.log +0 -0
  10. package/__tests__/dbml2sql/filename --oracle --out-file/dbml-error.log +0 -0
  11. package/__tests__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +0 -61
  12. package/__tests__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
  13. package/__tests__/dbml2sql/filename --out-file/dbml-error.log +0 -0
  14. package/__tests__/dbml2sql/filename --out-file/out-files/schema.sql +0 -77
  15. package/__tests__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -0
  16. package/__tests__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +0 -77
  17. package/__tests__/dbml2sql/filename --postgres stdout/dbml-error.log +0 -0
  18. package/__tests__/dbml2sql/filename stdout/dbml-error.log +0 -0
  19. package/__tests__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -0
  20. package/__tests__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +0 -172
  21. package/__tests__/dbml2sql/filenames --mysql stdout/dbml-error.log +0 -0
  22. package/__tests__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
  23. package/__tests__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +0 -172
  24. package/__tests__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
  25. package/__tests__/dbml2sql/filenames --out-file/dbml-error.log +0 -0
  26. package/__tests__/dbml2sql/filenames --out-file/out-files/schema.sql +0 -172
  27. package/__tests__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -0
  28. package/__tests__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +0 -172
  29. package/__tests__/dbml2sql/filenames --postgres stdout/dbml-error.log +0 -0
  30. package/__tests__/dbml2sql/filenames stdout/dbml-error.log +0 -0
  31. package/__tests__/dbml2sql/multifile aliased import stdout/dbml-error.log +0 -0
  32. package/__tests__/dbml2sql/multifile circular import stdout/dbml-error.log +0 -0
  33. package/__tests__/dbml2sql/multifile complex stdout/dbml-error.log +0 -0
  34. package/__tests__/dbml2sql/multifile error entry-syntax-error/dbml-error.log +0 -25
  35. package/__tests__/dbml2sql/multifile error import-not-found/dbml-error.log +0 -5142
  36. package/__tests__/dbml2sql/multifile error imported-syntax-error/dbml-error.log +0 -25
  37. package/__tests__/dbml2sql/multifile error transitive-use-not-visible/dbml-error.log +0 -20
  38. package/__tests__/dbml2sql/multifile records pulling stdout/dbml-error.log +0 -0
  39. package/__tests__/dbml2sql/multifile refs across files stdout/dbml-error.log +0 -0
  40. package/__tests__/dbml2sql/multifile schema pulling stdout/dbml-error.log +0 -0
  41. package/__tests__/dbml2sql/multifile tablegroup pulling stdout/dbml-error.log +0 -0
  42. package/__tests__/dbml2sql/multifile transitive reuse stdout/dbml-error.log +0 -0
  43. package/__tests__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -0
  44. package/__tests__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +0 -62
  45. package/__tests__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -0
  46. package/__tests__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +0 -50
  47. package/__tests__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
  48. package/__tests__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +0 -88
  49. package/__tests__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -0
  50. package/__tests__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +0 -67
  51. package/__tests__/dbml2sql/single file stdout/dbml-error.log +0 -0
  52. package/__tests__/dbml2sql/syntax-error/dbml-error.log +0 -25
  53. package/__tests__/sql2dbml/custom-error-alter-table-column-not-found --oracle/dbml-error.log +0 -20
  54. package/__tests__/sql2dbml/custom-error-alter-table-table-not-found --oracle/dbml-error.log +0 -20
  55. package/__tests__/sql2dbml/custom-error-column-comment-column-not-found --oracle/dbml-error.log +0 -20
  56. package/__tests__/sql2dbml/custom-error-column-comment-table-not-found --oracle/dbml-error.log +0 -20
  57. package/__tests__/sql2dbml/custom-error-create-index-table-not-found --oracle/dbml-error.log +0 -20
  58. package/__tests__/sql2dbml/custom-error-table-comment-table-not-found --oracle/dbml-error.log +0 -20
  59. package/__tests__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -0
  60. package/__tests__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +0 -25
  61. package/__tests__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -0
  62. package/__tests__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +0 -74
  63. package/__tests__/sql2dbml/filename --mysql stdout/dbml-error.log +0 -0
  64. package/__tests__/sql2dbml/filename --oracle --out-file/dbml-error.log +0 -0
  65. package/__tests__/sql2dbml/filename --oracle --out-file/out-files/schema.dbml +0 -83
  66. package/__tests__/sql2dbml/filename --out-file/dbml-error.log +0 -0
  67. package/__tests__/sql2dbml/filename --out-file/out-files/schema.dbml +0 -74
  68. package/__tests__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -0
  69. package/__tests__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +0 -74
  70. package/__tests__/sql2dbml/filename --postgres stdout/dbml-error.log +0 -0
  71. package/__tests__/sql2dbml/filename --snowflake stdout/dbml-error.log +0 -0
  72. package/__tests__/sql2dbml/filename stdout/dbml-error.log +0 -0
  73. package/__tests__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -0
  74. package/__tests__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +0 -170
  75. package/__tests__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -0
  76. package/__tests__/sql2dbml/filenames --out-file/dbml-error.log +0 -0
  77. package/__tests__/sql2dbml/filenames --out-file/out-files/schema.dbml +0 -170
  78. package/__tests__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -0
  79. package/__tests__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +0 -170
  80. package/__tests__/sql2dbml/filenames --postgres stdout/dbml-error.log +0 -0
  81. package/__tests__/sql2dbml/filenames stdout/dbml-error.log +0 -0
  82. package/__tests__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -0
  83. package/__tests__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +0 -58
  84. package/__tests__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -0
  85. package/__tests__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +0 -136
  86. package/__tests__/sql2dbml/multiple_schema_pg/dbml-error.log +0 -0
  87. package/__tests__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +0 -101
  88. package/__tests__/sql2dbml/syntax-error/dbml-error.log +0 -20
  89. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +0 -20
  90. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +0 -20
@@ -1,172 +0,0 @@
1
- -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
- -- Database: MySQL
3
- -- Generated at: 2026-07-22T11:09:44.040Z
4
-
5
- CREATE TABLE `staff` (
6
- `id` int PRIMARY KEY,
7
- `first_name` varchar(255),
8
- `last_name` varchar(255),
9
- `address_id` int,
10
- `picture` blob,
11
- `email` varchar(255),
12
- `store_id` int,
13
- `active` boolean,
14
- `user_name` varchar(255),
15
- `password` varchar(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` decimal,
32
- `payment_date` datetime,
33
- `last_update` timestamp
34
- );
35
-
36
- CREATE TABLE `rental` (
37
- `id` int PRIMARY KEY,
38
- `rental_date` datetime,
39
- `inventory_id` int,
40
- `customer_id` int,
41
- `return_date` ddatetime,
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` varchar(255),
58
- `last_update` timestamp
59
- );
60
-
61
- CREATE TABLE `city` (
62
- `id` int PRIMARY KEY,
63
- `city` varchar(255),
64
- `country_id` int,
65
- `last_update` timestamp
66
- );
67
-
68
- CREATE TABLE `address` (
69
- `id` int PRIMARY KEY,
70
- `address` varchar(255),
71
- `address2` varchar(255),
72
- `district` varchar(255),
73
- `city_id` int,
74
- `postal_code` varchar(255),
75
- `phone` varchar(255),
76
- `last_update` timestamp
77
- );
78
-
79
- CREATE TABLE `customer` (
80
- `id` int PRIMARY KEY,
81
- `store_id` int,
82
- `first_name` varchar(255),
83
- `last_name` varchar(255),
84
- `email` varchar(255),
85
- `address_id` int,
86
- `active` boolean,
87
- `create_Date` timestamp,
88
- `last_update` timestamp
89
- );
90
-
91
- CREATE INDEX `customer_index_0` ON `customer` (`id`, `first_name`) USING BTREE;
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` varchar(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` varchar(255),
113
- `last_update` timestamp
114
- );
115
-
116
- CREATE TABLE `film_text` (
117
- `id` int PRIMARY KEY,
118
- `film_id` int,
119
- `title` varchar(255),
120
- `description` text
121
- );
122
-
123
- CREATE TABLE `actor` (
124
- `id` int PRIMARY KEY,
125
- `first_name` varchar(255),
126
- `last_name` varchar(255),
127
- `last_update` timestamp
128
- );
129
-
130
- CREATE TABLE `film` (
131
- `id` int PRIMARY KEY,
132
- `title` varchar(255),
133
- `description` text,
134
- `releaase_year` int,
135
- `language_id` int,
136
- `original_language_id` int,
137
- `rental_duration` int,
138
- `rental_rate` decimal,
139
- `length` int,
140
- `replacement_cost` decimal,
141
- `rating` varchar(255),
142
- `special_feature` varchar(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 `inventory` (`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`);
@@ -1,172 +0,0 @@
1
- -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
- -- Database: Oracle
3
- -- Generated at: 2026-07-22T11:09:45.278Z
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") DEFERRABLE INITIALLY IMMEDIATE;
47
-
48
- ALTER TABLE "store" ADD FOREIGN KEY ("manager_staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
49
-
50
- ALTER TABLE "payment" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
51
-
52
- ALTER TABLE "payment" ADD FOREIGN KEY ("rental_id") REFERENCES "rental" ("id") DEFERRABLE INITIALLY IMMEDIATE;
53
-
54
- ALTER TABLE "rental" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
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") DEFERRABLE INITIALLY IMMEDIATE;
94
-
95
- ALTER TABLE "address" ADD FOREIGN KEY ("city_id") REFERENCES "city" ("id") DEFERRABLE INITIALLY IMMEDIATE;
96
-
97
- ALTER TABLE "customer" ADD FOREIGN KEY ("address_id") REFERENCES "address" ("id") DEFERRABLE INITIALLY IMMEDIATE;
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") DEFERRABLE INITIALLY IMMEDIATE;
161
-
162
- ALTER TABLE "film_text" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id") DEFERRABLE INITIALLY IMMEDIATE;
163
-
164
- ALTER TABLE "film" ADD FOREIGN KEY ("language_id") REFERENCES "language" ("id") DEFERRABLE INITIALLY IMMEDIATE;
165
-
166
- ALTER TABLE "film" ADD FOREIGN KEY ("original_language_id") REFERENCES "language" ("id") DEFERRABLE INITIALLY IMMEDIATE;
167
-
168
- ALTER TABLE "film_actor" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id") DEFERRABLE INITIALLY IMMEDIATE;
169
-
170
- ALTER TABLE "film_actor" ADD FOREIGN KEY ("actor_id") REFERENCES "actor" ("id") DEFERRABLE INITIALLY IMMEDIATE;
171
-
172
- ALTER TABLE "inventory" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id") DEFERRABLE INITIALLY IMMEDIATE;
@@ -1,172 +0,0 @@
1
- -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
- -- Database: PostgreSQL
3
- -- Generated at: 2026-07-22T11:09:46.511Z
4
-
5
- CREATE TABLE "staff" (
6
- "id" int PRIMARY KEY,
7
- "first_name" varchar,
8
- "last_name" varchar,
9
- "address_id" int,
10
- "picture" blob,
11
- "email" varchar,
12
- "store_id" int,
13
- "active" boolean,
14
- "user_name" varchar,
15
- "password" varchar,
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" decimal,
32
- "payment_date" datetime,
33
- "last_update" timestamp
34
- );
35
-
36
- CREATE TABLE "rental" (
37
- "id" int PRIMARY KEY,
38
- "rental_date" datetime,
39
- "inventory_id" int,
40
- "customer_id" int,
41
- "return_date" ddatetime,
42
- "staff_id" int,
43
- "last_update" timestamp
44
- );
45
-
46
- ALTER TABLE "staff" ADD FOREIGN KEY ("store_id") REFERENCES "store" ("id") DEFERRABLE INITIALLY IMMEDIATE;
47
-
48
- ALTER TABLE "store" ADD FOREIGN KEY ("manager_staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
49
-
50
- ALTER TABLE "payment" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
51
-
52
- ALTER TABLE "payment" ADD FOREIGN KEY ("rental_id") REFERENCES "rental" ("id") DEFERRABLE INITIALLY IMMEDIATE;
53
-
54
- ALTER TABLE "rental" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
55
- CREATE TABLE "country" (
56
- "id" int PRIMARY KEY,
57
- "country" varchar,
58
- "last_update" timestamp
59
- );
60
-
61
- CREATE TABLE "city" (
62
- "id" int PRIMARY KEY,
63
- "city" varchar,
64
- "country_id" int,
65
- "last_update" timestamp
66
- );
67
-
68
- CREATE TABLE "address" (
69
- "id" int PRIMARY KEY,
70
- "address" varchar,
71
- "address2" varchar,
72
- "district" varchar,
73
- "city_id" int,
74
- "postal_code" varchar,
75
- "phone" varchar,
76
- "last_update" timestamp
77
- );
78
-
79
- CREATE TABLE "customer" (
80
- "id" int PRIMARY KEY,
81
- "store_id" int,
82
- "first_name" varchar,
83
- "last_name" varchar,
84
- "email" varchar,
85
- "address_id" int,
86
- "active" boolean,
87
- "create_Date" timestamp,
88
- "last_update" timestamp
89
- );
90
-
91
- CREATE INDEX ON "customer" USING BTREE ("id", "first_name");
92
-
93
- ALTER TABLE "city" ADD FOREIGN KEY ("country_id") REFERENCES "country" ("id") DEFERRABLE INITIALLY IMMEDIATE;
94
-
95
- ALTER TABLE "address" ADD FOREIGN KEY ("city_id") REFERENCES "city" ("id") DEFERRABLE INITIALLY IMMEDIATE;
96
-
97
- ALTER TABLE "customer" ADD FOREIGN KEY ("address_id") REFERENCES "address" ("id") DEFERRABLE INITIALLY IMMEDIATE;
98
- CREATE TABLE "category" (
99
- "id" int PRIMARY KEY,
100
- "name" varchar,
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" varchar,
113
- "last_update" timestamp
114
- );
115
-
116
- CREATE TABLE "film_text" (
117
- "id" int PRIMARY KEY,
118
- "film_id" int,
119
- "title" varchar,
120
- "description" text
121
- );
122
-
123
- CREATE TABLE "actor" (
124
- "id" int PRIMARY KEY,
125
- "first_name" varchar,
126
- "last_name" varchar,
127
- "last_update" timestamp
128
- );
129
-
130
- CREATE TABLE "film" (
131
- "id" int PRIMARY KEY,
132
- "title" varchar,
133
- "description" text,
134
- "releaase_year" int,
135
- "language_id" int,
136
- "original_language_id" int,
137
- "rental_duration" int,
138
- "rental_rate" decimal,
139
- "length" int,
140
- "replacement_cost" decimal,
141
- "rating" varchar,
142
- "special_feature" varchar,
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") DEFERRABLE INITIALLY IMMEDIATE;
161
-
162
- ALTER TABLE "film_text" ADD FOREIGN KEY ("film_id") REFERENCES "inventory" ("film_id") DEFERRABLE INITIALLY IMMEDIATE;
163
-
164
- ALTER TABLE "film" ADD FOREIGN KEY ("language_id") REFERENCES "language" ("id") DEFERRABLE INITIALLY IMMEDIATE;
165
-
166
- ALTER TABLE "film" ADD FOREIGN KEY ("original_language_id") REFERENCES "language" ("id") DEFERRABLE INITIALLY IMMEDIATE;
167
-
168
- ALTER TABLE "film_actor" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id") DEFERRABLE INITIALLY IMMEDIATE;
169
-
170
- ALTER TABLE "film_actor" ADD FOREIGN KEY ("actor_id") REFERENCES "actor" ("id") DEFERRABLE INITIALLY IMMEDIATE;
171
-
172
- ALTER TABLE "inventory" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id") DEFERRABLE INITIALLY IMMEDIATE;
@@ -1,172 +0,0 @@
1
- -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
- -- Database: PostgreSQL
3
- -- Generated at: 2026-07-22T11:09:47.142Z
4
-
5
- CREATE TABLE "staff" (
6
- "id" int PRIMARY KEY,
7
- "first_name" varchar,
8
- "last_name" varchar,
9
- "address_id" int,
10
- "picture" blob,
11
- "email" varchar,
12
- "store_id" int,
13
- "active" boolean,
14
- "user_name" varchar,
15
- "password" varchar,
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" decimal,
32
- "payment_date" datetime,
33
- "last_update" timestamp
34
- );
35
-
36
- CREATE TABLE "rental" (
37
- "id" int PRIMARY KEY,
38
- "rental_date" datetime,
39
- "inventory_id" int,
40
- "customer_id" int,
41
- "return_date" ddatetime,
42
- "staff_id" int,
43
- "last_update" timestamp
44
- );
45
-
46
- ALTER TABLE "staff" ADD FOREIGN KEY ("store_id") REFERENCES "store" ("id") DEFERRABLE INITIALLY IMMEDIATE;
47
-
48
- ALTER TABLE "store" ADD FOREIGN KEY ("manager_staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
49
-
50
- ALTER TABLE "payment" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
51
-
52
- ALTER TABLE "payment" ADD FOREIGN KEY ("rental_id") REFERENCES "rental" ("id") DEFERRABLE INITIALLY IMMEDIATE;
53
-
54
- ALTER TABLE "rental" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
55
- CREATE TABLE "country" (
56
- "id" int PRIMARY KEY,
57
- "country" varchar,
58
- "last_update" timestamp
59
- );
60
-
61
- CREATE TABLE "city" (
62
- "id" int PRIMARY KEY,
63
- "city" varchar,
64
- "country_id" int,
65
- "last_update" timestamp
66
- );
67
-
68
- CREATE TABLE "address" (
69
- "id" int PRIMARY KEY,
70
- "address" varchar,
71
- "address2" varchar,
72
- "district" varchar,
73
- "city_id" int,
74
- "postal_code" varchar,
75
- "phone" varchar,
76
- "last_update" timestamp
77
- );
78
-
79
- CREATE TABLE "customer" (
80
- "id" int PRIMARY KEY,
81
- "store_id" int,
82
- "first_name" varchar,
83
- "last_name" varchar,
84
- "email" varchar,
85
- "address_id" int,
86
- "active" boolean,
87
- "create_Date" timestamp,
88
- "last_update" timestamp
89
- );
90
-
91
- CREATE INDEX ON "customer" USING BTREE ("id", "first_name");
92
-
93
- ALTER TABLE "city" ADD FOREIGN KEY ("country_id") REFERENCES "country" ("id") DEFERRABLE INITIALLY IMMEDIATE;
94
-
95
- ALTER TABLE "address" ADD FOREIGN KEY ("city_id") REFERENCES "city" ("id") DEFERRABLE INITIALLY IMMEDIATE;
96
-
97
- ALTER TABLE "customer" ADD FOREIGN KEY ("address_id") REFERENCES "address" ("id") DEFERRABLE INITIALLY IMMEDIATE;
98
- CREATE TABLE "category" (
99
- "id" int PRIMARY KEY,
100
- "name" varchar,
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" varchar,
113
- "last_update" timestamp
114
- );
115
-
116
- CREATE TABLE "film_text" (
117
- "id" int PRIMARY KEY,
118
- "film_id" int,
119
- "title" varchar,
120
- "description" text
121
- );
122
-
123
- CREATE TABLE "actor" (
124
- "id" int PRIMARY KEY,
125
- "first_name" varchar,
126
- "last_name" varchar,
127
- "last_update" timestamp
128
- );
129
-
130
- CREATE TABLE "film" (
131
- "id" int PRIMARY KEY,
132
- "title" varchar,
133
- "description" text,
134
- "releaase_year" int,
135
- "language_id" int,
136
- "original_language_id" int,
137
- "rental_duration" int,
138
- "rental_rate" decimal,
139
- "length" int,
140
- "replacement_cost" decimal,
141
- "rating" varchar,
142
- "special_feature" varchar,
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") DEFERRABLE INITIALLY IMMEDIATE;
161
-
162
- ALTER TABLE "film_text" ADD FOREIGN KEY ("film_id") REFERENCES "inventory" ("film_id") DEFERRABLE INITIALLY IMMEDIATE;
163
-
164
- ALTER TABLE "film" ADD FOREIGN KEY ("language_id") REFERENCES "language" ("id") DEFERRABLE INITIALLY IMMEDIATE;
165
-
166
- ALTER TABLE "film" ADD FOREIGN KEY ("original_language_id") REFERENCES "language" ("id") DEFERRABLE INITIALLY IMMEDIATE;
167
-
168
- ALTER TABLE "film_actor" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id") DEFERRABLE INITIALLY IMMEDIATE;
169
-
170
- ALTER TABLE "film_actor" ADD FOREIGN KEY ("actor_id") REFERENCES "actor" ("id") DEFERRABLE INITIALLY IMMEDIATE;
171
-
172
- ALTER TABLE "inventory" ADD FOREIGN KEY ("film_id") REFERENCES "film" ("id") DEFERRABLE INITIALLY IMMEDIATE;