Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PB138 - Film Database Group Project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tomáš Havlíček
PB138 - Film Database Group Project
Commits
6d626192
There was an error fetching the commit references. Please try again later.
Commit
6d626192
authored
2 years ago
by
Lukáš Kratochvíl
Browse files
Options
Downloads
Patches
Plain Diff
feat: Prisma init migration
parent
d21b4de2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/prisma/migrations/20220614193457_init/migration.sql
+70
-0
70 additions, 0 deletions
backend/prisma/migrations/20220614193457_init/migration.sql
backend/prisma/migrations/migration_lock.toml
+3
-0
3 additions, 0 deletions
backend/prisma/migrations/migration_lock.toml
with
73 additions
and
0 deletions
backend/prisma/migrations/20220614193457_init/migration.sql
0 → 100644
+
70
−
0
View file @
6d626192
-- CreateTable
CREATE
TABLE
"Movie"
(
"id"
TEXT
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
"updatedAt"
TIMESTAMP
(
3
)
NOT
NULL
,
"deletedAt"
TIMESTAMP
(
3
),
"name"
TEXT
NOT
NULL
,
"originalName"
TEXT
NOT
NULL
,
"intro"
TEXT
NOT
NULL
,
"picture"
TEXT
,
"publishedAt"
TIMESTAMP
(
3
)
NOT
NULL
,
"runTimeMinutes"
INTEGER
NOT
NULL
,
"directorId"
TEXT
NOT
NULL
,
CONSTRAINT
"Movie_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateTable
CREATE
TABLE
"Director"
(
"id"
TEXT
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
"updatedAt"
TIMESTAMP
(
3
)
NOT
NULL
,
"deletedAt"
TIMESTAMP
(
3
),
"name"
TEXT
NOT
NULL
,
"surname"
TEXT
NOT
NULL
,
"birthDate"
TIMESTAMP
(
3
),
CONSTRAINT
"Director_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateTable
CREATE
TABLE
"Category"
(
"id"
TEXT
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
"updatedAt"
TIMESTAMP
(
3
)
NOT
NULL
,
"deletedAt"
TIMESTAMP
(
3
),
"name"
TEXT
NOT
NULL
,
CONSTRAINT
"Category_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateTable
CREATE
TABLE
"_MovieCategory"
(
"A"
TEXT
NOT
NULL
,
"B"
TEXT
NOT
NULL
);
-- CreateIndex
CREATE
UNIQUE
INDEX
"Movie_originalName_publishedAt_directorId_key"
ON
"Movie"
(
"originalName"
,
"publishedAt"
,
"directorId"
);
-- CreateIndex
CREATE
UNIQUE
INDEX
"Director_name_surname_birthDate_key"
ON
"Director"
(
"name"
,
"surname"
,
"birthDate"
);
-- CreateIndex
CREATE
UNIQUE
INDEX
"Category_name_key"
ON
"Category"
(
"name"
);
-- CreateIndex
CREATE
UNIQUE
INDEX
"_MovieCategory_AB_unique"
ON
"_MovieCategory"
(
"A"
,
"B"
);
-- CreateIndex
CREATE
INDEX
"_MovieCategory_B_index"
ON
"_MovieCategory"
(
"B"
);
-- AddForeignKey
ALTER
TABLE
"Movie"
ADD
CONSTRAINT
"Movie_directorId_fkey"
FOREIGN
KEY
(
"directorId"
)
REFERENCES
"Director"
(
"id"
)
ON
DELETE
RESTRICT
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
"_MovieCategory"
ADD
CONSTRAINT
"_MovieCategory_A_fkey"
FOREIGN
KEY
(
"A"
)
REFERENCES
"Category"
(
"id"
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
"_MovieCategory"
ADD
CONSTRAINT
"_MovieCategory_B_fkey"
FOREIGN
KEY
(
"B"
)
REFERENCES
"Movie"
(
"id"
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
This diff is collapsed.
Click to expand it.
backend/prisma/migrations/migration_lock.toml
0 → 100644
+
3
−
0
View file @
6d626192
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider
=
"postgresql"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment