Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoBackendAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
Backend
DojoBackendAPI
Commits
390180a6
Commit
390180a6
authored
2 years ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
Add Prisma init migration file
parent
34765553
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ExpressAPI/prisma/migrations/20230705152941_init/migration.sql
+87
-0
87 additions, 0 deletions
...ssAPI/prisma/migrations/20230705152941_init/migration.sql
ExpressAPI/prisma/migrations/migration_lock.toml
+3
-0
3 additions, 0 deletions
ExpressAPI/prisma/migrations/migration_lock.toml
with
90 additions
and
0 deletions
ExpressAPI/prisma/migrations/20230705152941_init/migration.sql
0 → 100644
+
87
−
0
View file @
390180a6
-- CreateTable
CREATE
TABLE
`User`
(
`id`
INTEGER
NOT
NULL
AUTO_INCREMENT
,
`firstname`
VARCHAR
(
191
)
NOT
NULL
,
`lastname`
VARCHAR
(
191
)
NULL
,
`mail`
VARCHAR
(
191
)
NULL
,
`password`
VARCHAR
(
191
)
NULL
,
`gitlabId`
INTEGER
NOT
NULL
,
`role`
VARCHAR
(
191
)
NULL
,
`deleted`
BOOLEAN
NOT
NULL
DEFAULT
false
,
UNIQUE
INDEX
`User_mail_key`
(
`mail`
),
UNIQUE
INDEX
`User_gitlabId_key`
(
`gitlabId`
),
PRIMARY
KEY
(
`id`
)
)
DEFAULT
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
;
-- CreateTable
CREATE
TABLE
`Enonce`
(
`name`
VARCHAR
(
191
)
NOT
NULL
,
`gitlabId`
INTEGER
NOT
NULL
,
`gitlabLink`
VARCHAR
(
191
)
NOT
NULL
,
`gitlabCreationInfo`
JSON
NOT
NULL
,
`gitlabLastInfo`
JSON
NOT
NULL
,
`gitlabLastInfoDate`
DATETIME
(
3
)
NOT
NULL
,
PRIMARY
KEY
(
`name`
)
)
DEFAULT
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
;
-- CreateTable
CREATE
TABLE
`Exercice`
(
`id`
CHAR
(
36
)
NOT
NULL
,
`enonceName`
VARCHAR
(
191
)
NOT
NULL
,
`name`
VARCHAR
(
191
)
NOT
NULL
,
`gitlabId`
INTEGER
NOT
NULL
,
`gitlabLink`
VARCHAR
(
191
)
NOT
NULL
,
`gitlabCreationInfo`
JSON
NOT
NULL
,
`gitlabLastInfo`
JSON
NOT
NULL
,
`gitlabLastInfoDate`
DATETIME
(
3
)
NOT
NULL
,
PRIMARY
KEY
(
`id`
)
)
DEFAULT
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
;
-- CreateTable
CREATE
TABLE
`Result`
(
`exerciceId`
CHAR
(
36
)
NOT
NULL
,
`dateTime`
DATETIME
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
(
3
),
`pass`
BOOLEAN
NOT
NULL
,
`details`
TEXT
NOT
NULL
,
PRIMARY
KEY
(
`exerciceId`
,
`dateTime`
)
)
DEFAULT
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
;
-- CreateTable
CREATE
TABLE
`_EnonceToUser`
(
`A`
VARCHAR
(
191
)
NOT
NULL
,
`B`
INTEGER
NOT
NULL
,
UNIQUE
INDEX
`_EnonceToUser_AB_unique`
(
`A`
,
`B`
),
INDEX
`_EnonceToUser_B_index`
(
`B`
)
)
DEFAULT
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
;
-- CreateTable
CREATE
TABLE
`_ExerciceToUser`
(
`A`
CHAR
(
36
)
NOT
NULL
,
`B`
INTEGER
NOT
NULL
,
UNIQUE
INDEX
`_ExerciceToUser_AB_unique`
(
`A`
,
`B`
),
INDEX
`_ExerciceToUser_B_index`
(
`B`
)
)
DEFAULT
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
;
-- AddForeignKey
ALTER
TABLE
`Exercice`
ADD
CONSTRAINT
`Exercice_enonceName_fkey`
FOREIGN
KEY
(
`enonceName`
)
REFERENCES
`Enonce`
(
`name`
)
ON
DELETE
NO
ACTION
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
`Result`
ADD
CONSTRAINT
`Result_exerciceId_fkey`
FOREIGN
KEY
(
`exerciceId`
)
REFERENCES
`Exercice`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
`_EnonceToUser`
ADD
CONSTRAINT
`_EnonceToUser_A_fkey`
FOREIGN
KEY
(
`A`
)
REFERENCES
`Enonce`
(
`name`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
`_EnonceToUser`
ADD
CONSTRAINT
`_EnonceToUser_B_fkey`
FOREIGN
KEY
(
`B`
)
REFERENCES
`User`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
`_ExerciceToUser`
ADD
CONSTRAINT
`_ExerciceToUser_A_fkey`
FOREIGN
KEY
(
`A`
)
REFERENCES
`Exercice`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
`_ExerciceToUser`
ADD
CONSTRAINT
`_ExerciceToUser_B_fkey`
FOREIGN
KEY
(
`B`
)
REFERENCES
`User`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
This diff is collapsed.
Click to expand it.
ExpressAPI/prisma/migrations/migration_lock.toml
0 → 100644
+
3
−
0
View file @
390180a6
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider
=
"mysql"
\ 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