Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
treinamento-2025.1-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RICARDO PRADO FARIA
treinamento-2025.1-backend
Commits
67b35225
Commit
67b35225
authored
3 months ago
by
Amanda Pollyanna da Silva Rodrigues
Browse files
Options
Downloads
Plain Diff
Merge branch 'issue-8/update-schema-bodyparts' into 'develop'
Issue
#8
ADD purchase/bodyparts table See merge request
!8
parents
5f207568
39b686f8
No related branches found
No related tags found
1 merge request
!8
Issue #8 ADD purchase/bodyparts table
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/db/schema.ts
+22
-2
22 additions, 2 deletions
src/db/schema.ts
with
22 additions
and
2 deletions
src/db/schema.ts
+
22
−
2
View file @
67b35225
import
{
serial
,
varchar
,
timestamp
,
numeric
,
pgTable
}
from
"
drizzle-orm/pg-core
"
;
import
{
serial
,
varchar
,
timestamp
,
numeric
,
pgEnum
,
integer
,
pgTable
}
from
"
drizzle-orm/pg-core
"
;
export
const
implants
=
pgTable
(
'
implants
'
,
{
export
const
implants
Table
=
pgTable
(
'
implants
'
,
{
id
:
serial
(
'
id
'
).
primaryKey
().
unique
().
notNull
(),
name
:
varchar
(
'
nome
'
,
{
length
:
255
}).
notNull
(),
created_at
:
timestamp
(
'
created_at
'
).
notNull
().
defaultNow
(),
...
...
@@ -9,3 +9,23 @@ export const implants = pgTable('implants', {
bodyPart
:
varchar
(
'
bodyPart
'
,
{
length
:
255
}).
notNull
(),
updated_at
:
timestamp
(
'
updated_at
'
).
notNull
().
defaultNow
(),
});
export
const
bodyPartsEnum
=
pgEnum
(
'
bodyPartsEnum
'
,
[
'
FrontalCortex
'
,
'
OperatingSystem
'
,
'
Arms
'
,
'
Skeleton
'
,
'
NervousSystem
'
,
'
IntegumentarySystem
'
,
'
Face
'
,
'
Hands
'
,
'
CirculatorySystem
'
,
'
Legs
'
,
]);
export
const
purchasesTable
=
pgTable
(
'
pursaches
'
,
{
id
:
serial
(
'
id
'
).
primaryKey
().
unique
().
notNull
(),
user_id
:
integer
(
'
user_id
'
).
notNull
().
references
(()
=>
usersTable
.
id
,
{
onDelete
:
"
cascade
"
}),
implant_id
:
integer
(
'
user_id
'
).
notNull
().
references
(()
=>
implantsTable
.
id
,
{
onDelete
:
"
cascade
"
}),
created_at
:
timestamp
(
'
created_at
'
).
notNull
().
defaultNow
(),
})
\ 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