mobility-accounts/storage/postgresql/schema.hcl

82 lines
1.6 KiB
HCL

table "accounts" {
schema = schema.mobilityaccounts
column "id" {
null = false
type = uuid
}
column "namespace" {
null = true
type = text
}
column "data" {
null = true
type = jsonb
}
column "metadata" {
null = true
type = jsonb
}
primary_key {
columns = [column.id]
}
}
table "accounts_auth_local" {
schema = schema.mobilityaccounts
column "account_id" {
null = true
type = uuid
}
column "account_namespace" {
null = true
type = text
}
column "username" {
null = true
type = text
}
column "password" {
null = true
type = text
}
column "email" {
null = true
type = text
}
column "email_validation" {
null = true
type = jsonb
}
column "phone_number" {
null = true
type = text
}
column "phone_number_validation" {
null = true
type = jsonb
}
foreign_key "accounts_auth_local_account_id_fkey" {
columns = [column.account_id]
ref_columns = [table.accounts.column.id]
on_update = NO_ACTION
on_delete = NO_ACTION
}
index "accounts_auth_local_account_id_key" {
unique = true
columns = [column.account_id]
}
index "accounts_auth_local_idx_email" {
unique = true
columns = [column.account_namespace, column.email]
}
index "accounts_auth_local_idx_phone_number" {
unique = true
columns = [column.account_namespace, column.phone_number]
}
index "accounts_auth_local_idx_username" {
unique = true
columns = [column.account_namespace, column.username]
}
}
schema "mobilityaccounts" {
}