Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
1b34d53
feat: add use declarations and project layout
huydo862003 Mar 17, 2026
72c7b34
fix: rename DbmlProjectLayout to DBMLProjectLayout
huydo862003 Mar 17, 2026
3bce87e
revert: restore DbmlProjectLayout naming
huydo862003 Mar 17, 2026
297b859
fix: use DBML prefix consistently in test files
huydo862003 Mar 17, 2026
512c4e1
chore: remove workerpool dependency
huydo862003 Mar 17, 2026
bca2c01
chore: regenerate yarn lock file
huydo862003 Mar 17, 2026
75d49d6
feat: add warnings to FileIndex, analyzeProject and interpretProject
huydo862003 Mar 17, 2026
ac9dd13
refactor: project-wide analysis with shared nodeToSymbol/nodeToRefere…
huydo862003 Mar 17, 2026
16db4ae
refactor: move default nodeToReferee init to Binder constructor
huydo862003 Mar 17, 2026
436888f
refactor: simplify Validator constructor with ?? initialization
huydo862003 Mar 17, 2026
7a6c1e0
feat: add fileIndexes, localQuery/globalQuery, deleteSource/clearSour…
huydo862003 Mar 17, 2026
973e57e
refactor: make fileIndexes private
huydo862003 Mar 17, 2026
2e84479
chore: wip - remove the namespaced queries
huydo862003 Mar 17, 2026
be2c038
feat: add nodeSymbol, nodeReferences, nodeReferee globalQuery methods…
huydo862003 Mar 17, 2026
f38a9ea
refactor: make parseProject a globalQuery
huydo862003 Mar 17, 2026
597faea
feat: add container queries with clearer names (stackAtOffset, tokenA…
huydo862003 Mar 17, 2026
61b93cc
refactor: clean up queries - remove stale parse.ts, fix token/symbol …
huydo862003 Mar 17, 2026
d98fbe5
refactor: rename flatStream/invalidStream to flatTokenStream/invalidT…
huydo862003 Mar 17, 2026
78c00c5
refactor: migrate services and queries to flat compiler API, add erro…
huydo862003 Mar 17, 2026
f0f498f
docs: add section headers and signatures to compiler queries
huydo862003 Mar 17, 2026
156684d
chore: remove unused applyTextEdits import
huydo862003 Mar 17, 2026
6bdc25f
refactor: reorganize queries folder to mirror compiler API sections (…
huydo862003 Mar 17, 2026
1926839
docs: align section comment names with query folder names
huydo862003 Mar 17, 2026
859fa5f
refactor: make token queries local (per-file, filepath defaults to DE…
huydo862003 Mar 17, 2026
7a5e744
refactor: move FileIndex type into pipeline/parse.ts, re-export from …
huydo862003 Mar 17, 2026
3b9309f
docs: restore FileIndex comment in pipeline/parse.ts
huydo862003 Mar 17, 2026
0a24023
feat: add detectModules query - detect module boundaries from *.proje…
huydo862003 Mar 17, 2026
9c7e242
refactor: rename ModuleIndex → Module, detectModules → modules
huydo862003 Mar 17, 2026
3b9378f
refactor: extract ROOT constant to constants.ts
huydo862003 Mar 17, 2026
87dc332
feat: improve Module type and modules() query - add name field, Repor…
huydo862003 Mar 17, 2026
be8f67e
refactor: use Filepath for Module.dir instead of string
huydo862003 Mar 17, 2026
d14a840
fix: guard undefined symbolTable in renameTable
huydo862003 Mar 17, 2026
e0d7160
refactor: move module queries into dedicated modules/ folder
huydo862003 Mar 17, 2026
9312e4a
chore: stage deletion of pipeline/modules.ts after move to modules/
huydo862003 Mar 17, 2026
1a16fc8
feat: allow sticky note and schema kinds in use declaration validator
huydo862003 Mar 18, 2026
c2f0340
fix: type error
huydo862003 Mar 18, 2026
51aea0e
feat: annotate ProgramNode with filepath; filter filepath from test s…
huydo862003 Mar 18, 2026
5ae3134
test: update broken tests
huydo862003 Mar 20, 2026
0efd4d8
fix: revert breaking scoped queries to reduce review cognitive load
huydo862003 Mar 20, 2026
7a621c4
fix: change supported syntax for use declaration & support binding
huydo862003 Mar 20, 2026
8b4fc46
fix: remove modules queries
huydo862003 Mar 20, 2026
4fddabc
feat: add localSymbolTable local query, rename FileIndex to FileParse…
huydo862003 Mar 20, 2026
8e0109b
refactor: rename analyzeProject to resolveProject
huydo862003 Mar 20, 2026
7013cdb
refactor: break Analyzer into Validator & Binder, move symbol/ into v…
huydo862003 Mar 20, 2026
45387ed
refactor: add per-file bindFile and interpretFile local queries, bind…
huydo862003 Mar 20, 2026
b0cb73c
feat: add resolvedSymbolTable global query with symbol table cloning …
huydo862003 Mar 20, 2026
b5d7d20
refactor: Validator owns nodeToSymbol internally, no longer accepts o…
huydo862003 Mar 20, 2026
6a18801
fix: move imports to the top
huydo862003 Mar 20, 2026
85993bf
Revert "refactor: Validator owns nodeToSymbol internally, no longer a…
huydo862003 Mar 20, 2026
d408582
feat: add localFileDependencies local query
huydo862003 Mar 20, 2026
b7311a6
refactor: rename localSymbolTable to validateFile, add localSymbolTab…
huydo862003 Mar 20, 2026
f2e8d2b
feat: allow external and internal schemas to merge instead of conflic…
huydo862003 Mar 20, 2026
fcea4e6
refactor: use Filepath type for ExternalSymbol and SchemaSymbol, remo…
huydo862003 Mar 20, 2026
88a590a
merge refactor/ast-immutable into feat/module-system
huydo862003 Mar 20, 2026
0c713a2
feat: add Internable interface and intern() to SyntaxNode, NodeSymbol…
huydo862003 Mar 20, 2026
dec6ad0
refactor: add errors and warnings to FileLocalSymbolIndex, return it …
huydo862003 Mar 20, 2026
19c98b4
feat: report error on symbol conflict during external schema merge; i…
huydo862003 Mar 20, 2026
40e078b
refactor: remove parseProject, bindProject, interpretProject; use per…
huydo862003 Mar 20, 2026
976efea
refactor: restructure compiler pipeline for multi-file support
huydo862003 Mar 23, 2026
bea0d06
feat: tablegroup use pulls member tables into scope; add lookupSymbol…
huydo862003 Mar 23, 2026
c96ed3f
feat: add Model class with RawModel, NormalizedModel, and NormalizedD…
huydo862003 Mar 23, 2026
f0a64f9
feat: accept and return Model in exporter, importer, and parser via s…
huydo862003 Mar 23, 2026
c07c30b
feat: add Model tests; accept optional dbState in Database constructor
huydo862003 Mar 23, 2026
b84a5d8
Merge branch 'feat/model-raw-model-types' into feat/module-system
huydo862003 Mar 23, 2026
4678735
feat: multi-file module system with cross-file services
huydo862003 Mar 24, 2026
5f6182e
feat: enforce relative import paths in use declarations
huydo862003 Mar 24, 2026
698602b
feat: add filepath to TokenPosition, Database, and all interpreted ob…
huydo862003 Mar 24, 2026
46c2a85
feat: add typed token to all normalized interfaces for source locatio…
huydo862003 Mar 24, 2026
68df49e
feat: make filepath mandatory on ProgramNode, TokenPosition, Database
huydo862003 Mar 24, 2026
3d2e461
fix: revert changes to @dbml/core Parser
huydo862003 Mar 24, 2026
3ce4847
feat: add filepath to CompileError and CompileWarning
huydo862003 Mar 24, 2026
5472d3d
fix: revert changes to Parser.d.ts
huydo862003 Mar 24, 2026
126cf94
feat: propagate filepath to CompileError/CompileWarning and @dbml/cor…
huydo862003 Mar 24, 2026
8cf623a
Merge branch 'refactor/ast-immutable' into feat/module-system
huydo862003 Mar 24, 2026
f14f4f0
revert: restore @dbml/core Parser to old API
huydo862003 Mar 24, 2026
4c47b86
refactor: unbrand NodeSymbolIndex type
huydo862003 Mar 24, 2026
4b7270c
refactor: remove idx helper, use plain strings for symbol index
huydo862003 Mar 24, 2026
c241db5
fix: lint issues
huydo862003 Mar 24, 2026
d8d1273
refactor: consolidate multifile tests with test.each, 994 -> 374 lines
huydo862003 Mar 24, 2026
2a114cf
refactor: use compiler.symbol.nodeSymbol() instead of verbose bindFil…
huydo862003 Mar 24, 2026
e8185dd
refactor: exclude filepath from snapshot output; rename default entry…
huydo862003 Mar 24, 2026
cf32053
refactor: clean up multifile tests, remove redundant snapshots, reduc…
huydo862003 Mar 24, 2026
5b2a9a2
fix: serialize MockUri as plain string in inline snapshots
huydo862003 Mar 24, 2026
04d2ef0
refactor: consolidate use_declaration tests, remove multifile snapshots
huydo862003 Mar 24, 2026
a03888b
refactor: remove redundant use_declaration fuzz tests
huydo862003 Mar 24, 2026
2011dd4
refactor: remove multifile fuzz and property tests
huydo862003 Mar 24, 2026
3bed3f1
refactor: remove use_declaration property tests
huydo862003 Mar 24, 2026
4992e29
chore: remove sideEffects from package.json
huydo862003 Mar 24, 2026
d485ab6
test: remove stale tests
huydo862003 Mar 25, 2026
938d977
test: reformat multifile example tests
huydo862003 Mar 25, 2026
b69db50
test: reformat use_declaration
huydo862003 Mar 25, 2026
f8228a7
test: refactor MockUri and MockTextModel
huydo862003 Mar 25, 2026
931bc19
chore: ignore false-positive bearer
huydo862003 Mar 25, 2026
7ad5793
fix: remove the shouldReturnModel option
huydo862003 Mar 25, 2026
dcb7680
fix: embed filepath in nodes and tokens
huydo862003 Mar 25, 2026
ca32765
fix: revert exporter changes
huydo862003 Mar 25, 2026
67d0c3f
fix: do not expose token in normalized models
huydo862003 Mar 25, 2026
622bf67
fix: deduplicate NormalizedModel and NormalizedDatabaseIdMap & rename…
huydo862003 Mar 25, 2026
5234016
fix: add back the parse namespace but deprecate it
huydo862003 Mar 25, 2026
91f6061
feat: add parseDbmlProject to parser
huydo862003 Mar 25, 2026
09f8039
refactor: apply ast-immutable decisions — simplify interfaces, add an…
huydo862003 Mar 26, 2026
847328e
Merge branch 'refactor/ast-immutable' into feat/module-system
huydo862003 Mar 26, 2026
021c1bc
fix: address review issues - crash on listAllFiles, unsafe ExternalSy…
huydo862003 Mar 26, 2026
a3efce2
refactor: extract cached validateFile helper, deduplicate validation …
huydo862003 Mar 26, 2026
3e2dab0
fix: remove duplicate NormalizedModel
huydo862003 Mar 26, 2026
1a036de
fix: use Filepath for parseDbmlProject & export it from @dbml/core
huydo862003 Mar 26, 2026
01f8179
fix: pass compiler to interpreter
huydo862003 Mar 26, 2026
7213bda
refactor: use Compiler in snapshot tests, remove nodeToSymbol/nodeToR…
huydo862003 Mar 26, 2026
e8514ee
Merge branch 'refactor/ast-immutable' into feat/module-system
huydo862003 Mar 26, 2026
469be3f
refactor: remove filepath arg from resolvedSymbol/nodeReferee/nodeRef…
huydo862003 Mar 26, 2026
56bf6cd
refactor: use Compiler in example records.test.ts, remove analyze/ref…
huydo862003 Mar 26, 2026
2a9324c
Merge branch 'refactor/ast-immutable' into feat/module-system
huydo862003 Mar 26, 2026
3d88228
Merge branch 'refactor/ast-immutable' into feat/module-system
huydo862003 Mar 26, 2026
988393e
Merge branch 'refactor/ast-immutable' into feat/module-system
huydo862003 Mar 26, 2026
ce9f4a6
fix: use WeakMap for ProgramNode getter caches, regenerate snapshots
huydo862003 Mar 26, 2026
59977b3
chore: remove multifile snapshot tests
huydo862003 Mar 26, 2026
54e875a
refactor: make parseFile return Report, remove errors/warnings from F…
huydo862003 Mar 26, 2026
d70c76e
test: update interpreter fuzz tests
huydo862003 Mar 26, 2026
ba26d1c
refactor: remove cloning in resolveExternalDependencies, mutate symbo…
huydo862003 Mar 26, 2026
60d3530
style: break Validator and Interpreter constructor args onto separate…
huydo862003 Mar 26, 2026
fd17404
fix: minimize testHelpers.ts divergence from base branch, regenerate …
huydo862003 Mar 26, 2026
21eddc8
style: break element validator/binder/interpreter constructor and cal…
huydo862003 Mar 26, 2026
4c8729d
refactor: remove AnalyzeResult, unify with AnalysisResult, drop redun…
huydo862003 Mar 26, 2026
5ad0dbf
refactor: merge validate and bind pipeline into analyze/ folder
huydo862003 Mar 26, 2026
4ba3bfa
refactor: remove unused filepath param from symbolOfName and getNodeO…
huydo862003 Mar 26, 2026
1f7dfd8
refactor: move types back to original locations — symbol/ to core/ana…
huydo862003 Mar 26, 2026
e0e5ba6
refactor: remove unused filepath param from extractReferee
huydo862003 Mar 26, 2026
cfd8e0c
fix: restore deleted comments in recordRowSnippet to reduce divergence
huydo862003 Mar 26, 2026
02b4740
refactor: remove unused filepath param from suggestRecordRow helpers
huydo862003 Mar 26, 2026
2ef88c7
fix: remove unnecessary any
huydo862003 Mar 26, 2026
e05f64e
fix: restore base branch formatting in validator files, rename pickEl…
huydo862003 Mar 26, 2026
ab9bee9
refactor: move core/utils.ts back to core/analyzer/utils.ts
huydo862003 Mar 26, 2026
b50d968
fix: remove stale filepath args from resolvedSymbol/nodeReferee calls…
huydo862003 Mar 26, 2026
efcdb2b
refactor: simplify Validator constructor — always create own state, r…
huydo862003 Mar 26, 2026
3c219f5
fix: restore base branch formatting in records/index.ts and interpret…
huydo862003 Mar 26, 2026
1e0ed28
fix: restore base branch relative import paths in binder elementBinde…
huydo862003 Mar 26, 2026
0b5a4f8
fix: restore base branch import paths — @/compiler/index, relative va…
huydo862003 Mar 26, 2026
1a553ac
fix: revert getColumnSymbolsOfRefOperand to take Compiler directly, m…
huydo862003 Mar 26, 2026
77dbb1b
refactor: make validateFile return Report, remove symbolFactory from …
huydo862003 Mar 26, 2026
834909c
refactor: change SymbolToReferencesMap to WeakMap, matching base branch
huydo862003 Mar 26, 2026
544987c
refactor: restore core/utils.ts with general utilities, keep analyzer…
huydo862003 Mar 26, 2026
a5d89c5
refactor: remove filepath param from all suggest helpers, derive from…
huydo862003 Mar 26, 2026
eab9a8e
feat: add analyzeProject and interpretProject, make nodeReferences me…
huydo862003 Mar 26, 2026
0836ad7
fix: deduplicate nodeReferences results across project files
huydo862003 Mar 26, 2026
7db34f8
refactor: move localFileDependencies to pipeline/dependencies.ts
huydo862003 Mar 27, 2026
f40bb51
refactor: simplify localFileDependencies to return Set<FilepathId>, d…
huydo862003 Mar 27, 2026
9b67989
docs: add warning about symbolToReferences scope in analyzeFile
huydo862003 Mar 27, 2026
02f8470
docs: add example illustrating symbolToReferences scope limitation
huydo862003 Mar 27, 2026
ff653c9
docs: make analyzeFile comment more concise
huydo862003 Mar 27, 2026
bf41991
docs: mark pipeline queries as @internal, add guidance to prefer util…
huydo862003 Mar 27, 2026
d09237e
doc: make the comment more concise
huydo862003 Mar 27, 2026
e00b26d
feat: add delete method to SymbolTable
huydo862003 Mar 27, 2026
95c49b5
refactor: remove filepath param from Validator, Interpreter construct…
huydo862003 Mar 27, 2026
cfd34cf
refactor: scan AST directly in resolveExternalDependencies instead of…
huydo862003 Mar 27, 2026
65c2acd
fix: make syntax node intern robust to multi-file
huydo862003 Mar 27, 2026
563bca3
refactor: keep persistent nodeIdGenerator and symbolIdGenerator on Co…
huydo862003 Mar 27, 2026
a97726c
refactor: change NodeToSymbolMap, NodeToRefereeMap, SymbolToReference…
huydo862003 Mar 27, 2026
d25a4b9
refactor: add InternedMap and constrain Internable to primitive key t…
huydo862003 Mar 27, 2026
bb70401
fix: rename cacheKey to queryKey
huydo862003 Mar 27, 2026
b136f9a
fix: remove analyzeFile & interpretFile
huydo862003 Mar 27, 2026
33a3205
refactor: implement project-wide analyzeProject with shared maps
huydo862003 Mar 27, 2026
3997b3e
feat: cross-file tablepartial injection, schema merge, Project unique…
huydo862003 Mar 27, 2026
cbdb60c
fix: remove validateFile helper in pipeline/analyze
huydo862003 Mar 30, 2026
a617b8a
refactor: rename analyzer to binder, restructure pipeline queries (va…
huydo862003 Mar 30, 2026
0ad08ad
fix: wrong import path of Position
huydo862003 Mar 30, 2026
24315b5
test: add property-based tests for compiler intern stability and cros…
huydo862003 Mar 30, 2026
1f277e2
fix: add FileValidateIndex
huydo862003 Mar 30, 2026
38f1c76
feat: add FileValidateIndex type and note on node/symbol stability
huydo862003 Mar 30, 2026
83b0996
feat: add getNodeSymbolMapping
huydo862003 Mar 30, 2026
3dbda91
refactor: expose publicSchemaSymbol from validateFile, add getNodeSym…
huydo862003 Mar 30, 2026
3269183
refactor: remove getIntern/setIntern, update snapshots to drop duplic…
huydo862003 Mar 30, 2026
27a1b1d
fix: bindProject should just call bindFile
huydo862003 Mar 30, 2026
09b80ca
fix: simplify interpreter
huydo862003 Mar 30, 2026
fa674b2
feat: multi-file DBML support with use/reuse/alias, flat Database, Fi…
huydo862003 Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,96 +1,3 @@
CREATE TABLE `staff` (
`id` int PRIMARY KEY,
`first_name` varchar(255),
`last_name` varchar(255),
`address_id` int,
`picture` blob,
`email` varchar(255),
`store_id` int,
`active` boolean,
`user_name` varchar(255),
`password` varchar(255),
`last_update` timestamp
);

CREATE TABLE `store` (
`id` int PRIMARY KEY,
`manager_staff_id` int,
`address_id` int,
`last_update` timestamp
);

CREATE TABLE `payment` (
`id` int PRIMARY KEY,
`customer_id` int,
`staff_id` int,
`rental_id` int,
`amount` decimal,
`payment_date` datetime,
`last_update` timestamp
);

CREATE TABLE `rental` (
`id` int PRIMARY KEY,
`rental_date` datetime,
`inventory_id` int,
`customer_id` int,
`return_date` ddatetime,
`staff_id` int,
`last_update` timestamp
);

ALTER TABLE `staff` ADD FOREIGN KEY (`store_id`) REFERENCES `store` (`id`);

ALTER TABLE `store` ADD FOREIGN KEY (`manager_staff_id`) REFERENCES `staff` (`id`);

ALTER TABLE `payment` ADD FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`);

ALTER TABLE `payment` ADD FOREIGN KEY (`rental_id`) REFERENCES `rental` (`id`);

ALTER TABLE `rental` ADD FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`);
CREATE TABLE `country` (
`id` int PRIMARY KEY,
`country` varchar(255),
`last_update` timestamp
);

CREATE TABLE `city` (
`id` int PRIMARY KEY,
`city` varchar(255),
`country_id` int,
`last_update` timestamp
);

CREATE TABLE `address` (
`id` int PRIMARY KEY,
`address` varchar(255),
`address2` varchar(255),
`district` varchar(255),
`city_id` int,
`postal_code` varchar(255),
`phone` varchar(255),
`last_update` timestamp
);

CREATE TABLE `customer` (
`id` int PRIMARY KEY,
`store_id` int,
`first_name` varchar(255),
`last_name` varchar(255),
`email` varchar(255),
`address_id` int,
`active` boolean,
`create_Date` timestamp,
`last_update` timestamp
);

CREATE INDEX `customer_index_0` ON `customer` (`id`, `first_name`) USING BTREE;

ALTER TABLE `city` ADD FOREIGN KEY (`country_id`) REFERENCES `country` (`id`);

ALTER TABLE `address` ADD FOREIGN KEY (`city_id`) REFERENCES `city` (`id`);

ALTER TABLE `customer` ADD FOREIGN KEY (`address_id`) REFERENCES `address` (`id`);
CREATE TABLE `category` (
`id` int PRIMARY KEY,
`name` varchar(255),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,98 +1,3 @@
CREATE TABLE `staff` (
`id` int PRIMARY KEY,
`first_name` varchar(255),
`last_name` varchar(255),
`address_id` int,
`picture` blob,
`email` varchar(255),
`store_id` int,
`active` boolean,
`user_name` varchar(255),
`password` varchar(255),
`last_update` timestamp
);

CREATE TABLE `store` (
`id` int PRIMARY KEY,
`manager_staff_id` int,
`address_id` int,
`last_update` timestamp
);

CREATE TABLE `payment` (
`id` int PRIMARY KEY,
`customer_id` int,
`staff_id` int,
`rental_id` int,
`amount` decimal,
`payment_date` datetime,
`last_update` timestamp
);

CREATE TABLE `rental` (
`id` int PRIMARY KEY,
`rental_date` datetime,
`inventory_id` int,
`customer_id` int,
`return_date` ddatetime,
`staff_id` int,
`last_update` timestamp
);

ALTER TABLE `staff` ADD FOREIGN KEY (`store_id`) REFERENCES `store` (`id`);

ALTER TABLE `store` ADD FOREIGN KEY (`manager_staff_id`) REFERENCES `staff` (`id`);

ALTER TABLE `payment` ADD FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`);

ALTER TABLE `payment` ADD FOREIGN KEY (`rental_id`) REFERENCES `rental` (`id`);

ALTER TABLE `rental` ADD FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`);

CREATE TABLE `country` (
`id` int PRIMARY KEY,
`country` varchar(255),
`last_update` timestamp
);

CREATE TABLE `city` (
`id` int PRIMARY KEY,
`city` varchar(255),
`country_id` int,
`last_update` timestamp
);

CREATE TABLE `address` (
`id` int PRIMARY KEY,
`address` varchar(255),
`address2` varchar(255),
`district` varchar(255),
`city_id` int,
`postal_code` varchar(255),
`phone` varchar(255),
`last_update` timestamp
);

CREATE TABLE `customer` (
`id` int PRIMARY KEY,
`store_id` int,
`first_name` varchar(255),
`last_name` varchar(255),
`email` varchar(255),
`address_id` int,
`active` boolean,
`create_Date` timestamp,
`last_update` timestamp
);

CREATE INDEX `customer_index_0` ON `customer` (`id`, `first_name`) USING BTREE;

ALTER TABLE `city` ADD FOREIGN KEY (`country_id`) REFERENCES `country` (`id`);

ALTER TABLE `address` ADD FOREIGN KEY (`city_id`) REFERENCES `city` (`id`);

ALTER TABLE `customer` ADD FOREIGN KEY (`address_id`) REFERENCES `address` (`id`);

CREATE TABLE `category` (
`id` int PRIMARY KEY,
`name` varchar(255),
Expand Down Expand Up @@ -168,4 +73,3 @@ ALTER TABLE `film_actor` ADD FOREIGN KEY (`film_id`) REFERENCES `film` (`id`);
ALTER TABLE `film_actor` ADD FOREIGN KEY (`actor_id`) REFERENCES `actor` (`id`);

ALTER TABLE `inventory` ADD FOREIGN KEY (`film_id`) REFERENCES `film` (`id`);

Original file line number Diff line number Diff line change
@@ -1,96 +1,3 @@
CREATE TABLE "staff" (
"id" int PRIMARY KEY,
"first_name" nvarchar2(255),
"last_name" nvarchar2(255),
"address_id" int,
"picture" blob,
"email" nvarchar2(255),
"store_id" int,
"active" number(1),
"user_name" nvarchar2(255),
"password" nvarchar2(255),
"last_update" timestamp
);

CREATE TABLE "store" (
"id" int PRIMARY KEY,
"manager_staff_id" int,
"address_id" int,
"last_update" timestamp
);

CREATE TABLE "payment" (
"id" int PRIMARY KEY,
"customer_id" int,
"staff_id" int,
"rental_id" int,
"amount" float,
"payment_date" date,
"last_update" timestamp
);

CREATE TABLE "rental" (
"id" int PRIMARY KEY,
"rental_date" date,
"inventory_id" int,
"customer_id" int,
"return_date" date,
"staff_id" int,
"last_update" timestamp
);

ALTER TABLE "staff" ADD FOREIGN KEY ("store_id") REFERENCES "store" ("id") DEFERRABLE INITIALLY IMMEDIATE;

ALTER TABLE "store" ADD FOREIGN KEY ("manager_staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;

ALTER TABLE "payment" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;

ALTER TABLE "payment" ADD FOREIGN KEY ("rental_id") REFERENCES "rental" ("id") DEFERRABLE INITIALLY IMMEDIATE;

ALTER TABLE "rental" ADD FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") DEFERRABLE INITIALLY IMMEDIATE;
CREATE TABLE "country" (
"id" int PRIMARY KEY,
"country" nvarchar2(255),
"last_update" timestamp
);

CREATE TABLE "city" (
"id" int PRIMARY KEY,
"city" nvarchar2(255),
"country_id" int,
"last_update" timestamp
);

CREATE TABLE "address" (
"id" int PRIMARY KEY,
"address" nvarchar2(255),
"address2" nvarchar2(255),
"district" nvarchar2(255),
"city_id" int,
"postal_code" nvarchar2(255),
"phone" nvarchar2(255),
"last_update" timestamp
);

CREATE TABLE "customer" (
"id" int PRIMARY KEY,
"store_id" int,
"first_name" nvarchar2(255),
"last_name" nvarchar2(255),
"email" nvarchar2(255),
"address_id" int,
"active" number(1),
"create_Date" timestamp,
"last_update" timestamp
);

CREATE INDEX "IDX_CUSTOMER" ON "customer" ("id", "first_name");

ALTER TABLE "city" ADD FOREIGN KEY ("country_id") REFERENCES "country" ("id") DEFERRABLE INITIALLY IMMEDIATE;

ALTER TABLE "address" ADD FOREIGN KEY ("city_id") REFERENCES "city" ("id") DEFERRABLE INITIALLY IMMEDIATE;

ALTER TABLE "customer" ADD FOREIGN KEY ("address_id") REFERENCES "address" ("id") DEFERRABLE INITIALLY IMMEDIATE;
CREATE TABLE "category" (
"id" int PRIMARY KEY,
"name" nvarchar2(255),
Expand Down
Loading