Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
getraenkekasse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aaron Dötsch
getraenkekasse
Commits
c9b3da18
Commit
c9b3da18
authored
2 years ago
by
Aaron Dötsch
Browse files
Options
Downloads
Patches
Plain Diff
Add database initialisation
parent
2420ae27
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+0
-1
0 additions, 1 deletion
.gitignore
prisma/migrations/20230301145217_initial/migration.sql
+102
-0
102 additions, 0 deletions
prisma/migrations/20230301145217_initial/migration.sql
prisma/migrations/migration_lock.toml
+3
-0
3 additions, 0 deletions
prisma/migrations/migration_lock.toml
with
105 additions
and
1 deletion
.gitignore
+
0
−
1
View file @
c9b3da18
...
...
@@ -191,7 +191,6 @@ package
# End of https://www.toptal.com/developers/gitignore/api/svelte,git,visualstudiocode,node
### Prisma
prisma/migrations
prisma/*.db
prisma/*.db-journal
...
...
This diff is collapsed.
Click to expand it.
prisma/migrations/20230301145217_initial/migration.sql
0 → 100644
+
102
−
0
View file @
c9b3da18
-- CreateTable
CREATE
TABLE
"User"
(
"id"
SERIAL
NOT
NULL
,
"email"
TEXT
NOT
NULL
,
"name"
TEXT
NOT
NULL
,
"balance"
INTEGER
NOT
NULL
DEFAULT
0
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
"updatedAt"
TIMESTAMP
(
3
)
NOT
NULL
,
"comment"
TEXT
NOT
NULL
DEFAULT
''
,
CONSTRAINT
"User_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateTable
CREATE
TABLE
"UserCard"
(
"userId"
INTEGER
NOT
NULL
,
"card"
TEXT
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
"perms"
INTEGER
NOT
NULL
DEFAULT
0
,
"updatedAt"
TIMESTAMP
(
3
)
NOT
NULL
);
-- CreateTable
CREATE
TABLE
"Transaction"
(
"id"
SERIAL
NOT
NULL
,
"amount"
INTEGER
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
"userId"
INTEGER
NOT
NULL
,
CONSTRAINT
"Transaction_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateTable
CREATE
TABLE
"ItemCategory"
(
"id"
SERIAL
NOT
NULL
,
"name"
TEXT
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
CONSTRAINT
"ItemCategory_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateTable
CREATE
TABLE
"Item"
(
"code"
TEXT
NOT
NULL
,
"name"
TEXT
NOT
NULL
,
"price"
INTEGER
NOT
NULL
,
"categoryId"
INTEGER
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
"image"
TEXT
,
"stock"
INTEGER
NOT
NULL
DEFAULT
0
,
"available"
BOOLEAN
NOT
NULL
DEFAULT
true
,
CONSTRAINT
"Item_pkey"
PRIMARY
KEY
(
"code"
)
);
-- CreateTable
CREATE
TABLE
"ItemTransaction"
(
"id"
SERIAL
NOT
NULL
,
"itemCode"
TEXT
NOT
NULL
,
"userId"
INTEGER
NOT
NULL
,
"price"
INTEGER
NOT
NULL
,
"premium"
INTEGER
NOT
NULL
DEFAULT
0
,
"card"
TEXT
NOT
NULL
DEFAULT
''
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
CONSTRAINT
"ItemTransaction_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateTable
CREATE
TABLE
"Restock"
(
"id"
SERIAL
NOT
NULL
,
"amount"
INTEGER
NOT
NULL
,
"itemCode"
TEXT
NOT
NULL
,
"cost"
INTEGER
NOT
NULL
,
"createdAt"
TIMESTAMP
(
3
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
CONSTRAINT
"Restock_pkey"
PRIMARY
KEY
(
"id"
)
);
-- CreateIndex
CREATE
UNIQUE
INDEX
"User_email_key"
ON
"User"
(
"email"
);
-- CreateIndex
CREATE
UNIQUE
INDEX
"UserCard_card_key"
ON
"UserCard"
(
"card"
);
-- AddForeignKey
ALTER
TABLE
"UserCard"
ADD
CONSTRAINT
"UserCard_userId_fkey"
FOREIGN
KEY
(
"userId"
)
REFERENCES
"User"
(
"id"
)
ON
DELETE
RESTRICT
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
"Transaction"
ADD
CONSTRAINT
"Transaction_userId_fkey"
FOREIGN
KEY
(
"userId"
)
REFERENCES
"User"
(
"id"
)
ON
DELETE
RESTRICT
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
"Item"
ADD
CONSTRAINT
"Item_categoryId_fkey"
FOREIGN
KEY
(
"categoryId"
)
REFERENCES
"ItemCategory"
(
"id"
)
ON
DELETE
RESTRICT
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
"ItemTransaction"
ADD
CONSTRAINT
"ItemTransaction_itemCode_fkey"
FOREIGN
KEY
(
"itemCode"
)
REFERENCES
"Item"
(
"code"
)
ON
DELETE
RESTRICT
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
"ItemTransaction"
ADD
CONSTRAINT
"ItemTransaction_userId_fkey"
FOREIGN
KEY
(
"userId"
)
REFERENCES
"User"
(
"id"
)
ON
DELETE
RESTRICT
ON
UPDATE
CASCADE
;
-- AddForeignKey
ALTER
TABLE
"Restock"
ADD
CONSTRAINT
"Restock_itemCode_fkey"
FOREIGN
KEY
(
"itemCode"
)
REFERENCES
"Item"
(
"code"
)
ON
DELETE
RESTRICT
ON
UPDATE
CASCADE
;
This diff is collapsed.
Click to expand it.
prisma/migrations/migration_lock.toml
0 → 100644
+
3
−
0
View file @
c9b3da18
# 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