325 lines
5.4 KiB
HCL
325 lines
5.4 KiB
HCL
table "profiles" {
|
|
schema = schema.public
|
|
|
|
column "id" {
|
|
type = uuid
|
|
default = sql("gen_random_uuid()")
|
|
null = false
|
|
}
|
|
column "user_id" {
|
|
type = uuid
|
|
null = true
|
|
}
|
|
column "handle" {
|
|
type = text
|
|
null = false
|
|
}
|
|
|
|
// Hero fields
|
|
column "role_id" {
|
|
type = uuid
|
|
null = true
|
|
}
|
|
column "role_name" {
|
|
type = varchar(100)
|
|
null = true
|
|
}
|
|
column "role_level" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "first_name" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "last_name" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "company" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "short_description" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "resume_link" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "cta_enabled" {
|
|
type = boolean
|
|
default = false
|
|
null = false
|
|
}
|
|
column "avatar" {
|
|
type = text
|
|
null = true
|
|
}
|
|
|
|
// About fields
|
|
column "profile_picture" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "about" {
|
|
type = text
|
|
null = true
|
|
}
|
|
|
|
// Contact fields
|
|
column "email" {
|
|
type = text
|
|
null = true
|
|
}
|
|
column "phone" {
|
|
type = text
|
|
null = true
|
|
}
|
|
|
|
// PageSetting fields
|
|
column "visibility_level" {
|
|
type = text
|
|
default = "public"
|
|
null = false
|
|
}
|
|
|
|
// Complex data
|
|
column "page_section_order" {
|
|
type = jsonb
|
|
null = true
|
|
}
|
|
|
|
column "created_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
|
|
column "updated_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
|
|
column "deleted_at" {
|
|
type = timestamptz
|
|
null = true
|
|
}
|
|
|
|
primary_key {
|
|
columns = [column.id]
|
|
}
|
|
|
|
foreign_key "profiles_role_id_profile_roles_fk" {
|
|
columns = [column.role_id]
|
|
ref_columns = [table.profile_roles.column.id]
|
|
on_delete = SET_NULL
|
|
on_update = CASCADE
|
|
}
|
|
|
|
unique "profiles_handle_unique" {
|
|
columns = [column.handle]
|
|
}
|
|
|
|
index "profiles_user_id_idx" {
|
|
columns = [column.user_id]
|
|
}
|
|
|
|
index "profiles_role_id_idx" {
|
|
columns = [column.role_id]
|
|
}
|
|
|
|
index "profiles_name_idx" {
|
|
columns = [column.first_name, column.last_name]
|
|
}
|
|
|
|
index "profiles_company_idx" {
|
|
columns = [column.company]
|
|
}
|
|
|
|
index "profiles_email_idx" {
|
|
columns = [column.email]
|
|
}
|
|
|
|
index "profiles_deleted_at_idx" {
|
|
columns = [column.deleted_at]
|
|
}
|
|
}
|
|
|
|
table "profile_skills" {
|
|
schema = schema.public
|
|
|
|
column "id" {
|
|
type = uuid
|
|
default = sql("gen_random_uuid()")
|
|
null = false
|
|
}
|
|
column "profile_id" {
|
|
type = uuid
|
|
null = false
|
|
}
|
|
column "skill_name" {
|
|
type = text
|
|
null = false
|
|
}
|
|
column "level" {
|
|
type = text
|
|
null = false
|
|
}
|
|
column "created_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
column "updated_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
column "deleted_at" {
|
|
type = timestamptz
|
|
null = true
|
|
}
|
|
|
|
primary_key {
|
|
columns = [column.id]
|
|
}
|
|
|
|
foreign_key "profile_skills_profile_id_fk" {
|
|
columns = [column.profile_id]
|
|
ref_columns = [table.profiles.column.id]
|
|
on_delete = CASCADE
|
|
on_update = CASCADE
|
|
}
|
|
|
|
index "skills_profile_id_idx" {
|
|
columns = [column.profile_id]
|
|
}
|
|
|
|
index "skills_name_idx" {
|
|
columns = [column.skill_name]
|
|
}
|
|
|
|
index "profile_skills_deleted_at_idx" {
|
|
columns = [column.deleted_at]
|
|
}
|
|
}
|
|
|
|
table "profile_social_links" {
|
|
schema = schema.public
|
|
|
|
column "id" {
|
|
type = uuid
|
|
default = sql("gen_random_uuid()")
|
|
null = false
|
|
}
|
|
column "profile_id" {
|
|
type = uuid
|
|
null = false
|
|
}
|
|
column "link_type" {
|
|
type = text
|
|
null = false
|
|
}
|
|
column "link" {
|
|
type = text
|
|
null = false
|
|
}
|
|
column "created_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
column "updated_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
column "deleted_at" {
|
|
type = timestamptz
|
|
null = true
|
|
}
|
|
|
|
primary_key {
|
|
columns = [column.id]
|
|
}
|
|
|
|
foreign_key "profile_social_links_profile_id_fk" {
|
|
columns = [column.profile_id]
|
|
ref_columns = [table.profiles.column.id]
|
|
on_delete = CASCADE
|
|
on_update = CASCADE
|
|
}
|
|
|
|
index "social_links_profile_id_idx" {
|
|
columns = [column.profile_id]
|
|
}
|
|
|
|
index "profile_social_links_deleted_at_idx" {
|
|
columns = [column.deleted_at]
|
|
}
|
|
}
|
|
|
|
table "profile_achievements" {
|
|
schema = schema.public
|
|
|
|
column "id" {
|
|
type = uuid
|
|
default = sql("gen_random_uuid()")
|
|
null = false
|
|
}
|
|
column "profile_id" {
|
|
type = uuid
|
|
null = false
|
|
}
|
|
column "title" {
|
|
type = text
|
|
null = false
|
|
}
|
|
column "value" {
|
|
type = text
|
|
null = false
|
|
}
|
|
column "enabled" {
|
|
type = boolean
|
|
default = true
|
|
null = false
|
|
}
|
|
column "created_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
column "updated_at" {
|
|
type = timestamptz
|
|
default = sql("now()")
|
|
null = false
|
|
}
|
|
column "deleted_at" {
|
|
type = timestamptz
|
|
null = true
|
|
}
|
|
|
|
primary_key {
|
|
columns = [column.id]
|
|
}
|
|
|
|
foreign_key "profile_achievements_profile_id_fk" {
|
|
columns = [column.profile_id]
|
|
ref_columns = [table.profiles.column.id]
|
|
on_delete = CASCADE
|
|
on_update = CASCADE
|
|
}
|
|
|
|
index "achievements_profile_id_idx" {
|
|
columns = [column.profile_id]
|
|
}
|
|
|
|
index "profile_achievements_deleted_at_idx" {
|
|
columns = [column.deleted_at]
|
|
}
|
|
}
|
|
|