initial commit
This commit is contained in:
56
database/schema/user_role.pg.hcl
Normal file
56
database/schema/user_role.pg.hcl
Normal file
@@ -0,0 +1,56 @@
|
||||
table "user_roles" {
|
||||
schema = schema.public
|
||||
|
||||
column "id" {
|
||||
type = uuid
|
||||
null = false
|
||||
}
|
||||
|
||||
column "user_id" {
|
||||
type = uuid
|
||||
null = false
|
||||
}
|
||||
column "role_id" {
|
||||
type = uuid
|
||||
null = false
|
||||
}
|
||||
column "created_at" {
|
||||
type = timestamptz
|
||||
default = sql("now()")
|
||||
null = false
|
||||
}
|
||||
|
||||
column "updated_at" {
|
||||
type = timestamptz
|
||||
null = true
|
||||
default = sql("now()")
|
||||
}
|
||||
column "deleted_at" {
|
||||
type = timestamptz
|
||||
null = true
|
||||
}
|
||||
|
||||
primary_key {
|
||||
columns = [column.id]
|
||||
}
|
||||
|
||||
foreign_key "user_roles_user_id_fk" {
|
||||
columns = [column.user_id]
|
||||
ref_columns = [table.users.column.id]
|
||||
on_delete = CASCADE
|
||||
on_update = CASCADE
|
||||
}
|
||||
foreign_key "user_roles_role_id_fk" {
|
||||
columns = [column.role_id]
|
||||
ref_columns = [table.roles.column.id]
|
||||
on_delete = CASCADE
|
||||
on_update = CASCADE
|
||||
}
|
||||
|
||||
index "user_roles_user_id_idx" {
|
||||
columns = [column.user_id]
|
||||
}
|
||||
index "user_roles_role_id_idx" {
|
||||
columns = [column.role_id]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user