Files
alla-tms/drizzle/meta/0017_snapshot.json
2026-07-16 09:53:14 +07:00

3991 lines
106 KiB
JSON

{
"id": "c05966c1-9460-44f6-ae39-2b0b7238b3a4",
"prevId": "18410cc5-1d6f-4ae7-8e23-2b4f5a203b11",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.announcements": {
"name": "announcements",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "announcements_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"attachment_file_name": {
"name": "attachment_file_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachment_file_type": {
"name": "attachment_file_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachment_file_size": {
"name": "attachment_file_size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"attachment_storage_key": {
"name": "attachment_storage_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachment_file_url": {
"name": "attachment_file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"start_date": {
"name": "start_date",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"end_date": {
"name": "end_date",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"is_pin": {
"name": "is_pin",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"status": {
"name": "status",
"type": "announcement_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'draft'"
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"updated_by": {
"name": "updated_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"announcements_organization_id_organizations_id_fk": {
"name": "announcements_organization_id_organizations_id_fk",
"tableFrom": "announcements",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"announcements_created_by_users_id_fk": {
"name": "announcements_created_by_users_id_fk",
"tableFrom": "announcements",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"announcements_updated_by_users_id_fk": {
"name": "announcements_updated_by_users_id_fk",
"tableFrom": "announcements",
"tableTo": "users",
"columnsFrom": [
"updated_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.audit_logs": {
"name": "audit_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "audit_logs_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"module_name": {
"name": "module_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity_name": {
"name": "entity_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"entity_id": {
"name": "entity_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"old_value": {
"name": "old_value",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"new_value": {
"name": "new_value",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"ip_address": {
"name": "ip_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_agent": {
"name": "user_agent",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"audit_logs_organization_id_organizations_id_fk": {
"name": "audit_logs_organization_id_organizations_id_fk",
"tableFrom": "audit_logs",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"audit_logs_user_id_users_id_fk": {
"name": "audit_logs_user_id_users_id_fk",
"tableFrom": "audit_logs",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.certificates": {
"name": "certificates",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "certificates_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"training_record_id": {
"name": "training_record_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"file_name": {
"name": "file_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_type": {
"name": "file_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_size": {
"name": "file_size",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"storage_key": {
"name": "storage_key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_url": {
"name": "file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploaded_by": {
"name": "uploaded_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"uploaded_at": {
"name": "uploaded_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"certificates_organization_id_organizations_id_fk": {
"name": "certificates_organization_id_organizations_id_fk",
"tableFrom": "certificates",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"certificates_training_record_id_training_records_id_fk": {
"name": "certificates_training_record_id_training_records_id_fk",
"tableFrom": "certificates",
"tableTo": "training_records",
"columnsFrom": [
"training_record_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"certificates_uploaded_by_users_id_fk": {
"name": "certificates_uploaded_by_users_id_fk",
"tableFrom": "certificates",
"tableTo": "users",
"columnsFrom": [
"uploaded_by"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.courses": {
"name": "courses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "courses_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"course_code": {
"name": "course_code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true
},
"organizer": {
"name": "organizer",
"type": "text",
"primaryKey": false,
"notNull": false
},
"standard_hours": {
"name": "standard_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true,
"default": 0
},
"certificate_validity_months": {
"name": "certificate_validity_months",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_required": {
"name": "is_required",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"certificate_required": {
"name": "certificate_required",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"training_cost": {
"name": "training_cost",
"type": "double precision",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"courses_org_name_idx": {
"name": "courses_org_name_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"courses_organization_id_organizations_id_fk": {
"name": "courses_organization_id_organizations_id_fk",
"tableFrom": "courses",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.departments": {
"name": "departments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "departments_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"pending_master_review": {
"name": "pending_master_review",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"departments_org_code_idx": {
"name": "departments_org_code_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "code",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"departments_org_name_idx": {
"name": "departments_org_name_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"departments_organization_id_organizations_id_fk": {
"name": "departments_organization_id_organizations_id_fk",
"tableFrom": "departments",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.employee_training_targets": {
"name": "employee_training_targets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "employee_training_targets_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"employee_id": {
"name": "employee_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"total_target_minutes": {
"name": "total_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"total_hours": {
"name": "total_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"k_target_minutes": {
"name": "k_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"k_hours": {
"name": "k_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"s_target_minutes": {
"name": "s_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"s_hours": {
"name": "s_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"a_target_minutes": {
"name": "a_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"a_hours": {
"name": "a_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"updated_by": {
"name": "updated_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"employee_training_targets_org_user_year_idx": {
"name": "employee_training_targets_org_user_year_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "year",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"employee_training_targets_org_employee_year_idx": {
"name": "employee_training_targets_org_employee_year_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "employee_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "year",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"employee_training_targets_organization_id_organizations_id_fk": {
"name": "employee_training_targets_organization_id_organizations_id_fk",
"tableFrom": "employee_training_targets",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"employee_training_targets_user_id_users_id_fk": {
"name": "employee_training_targets_user_id_users_id_fk",
"tableFrom": "employee_training_targets",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"employee_training_targets_employee_id_employees_id_fk": {
"name": "employee_training_targets_employee_id_employees_id_fk",
"tableFrom": "employee_training_targets",
"tableTo": "employees",
"columnsFrom": [
"employee_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"employee_training_targets_created_by_users_id_fk": {
"name": "employee_training_targets_created_by_users_id_fk",
"tableFrom": "employee_training_targets",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"employee_training_targets_updated_by_users_id_fk": {
"name": "employee_training_targets_updated_by_users_id_fk",
"tableFrom": "employee_training_targets",
"tableTo": "users",
"columnsFrom": [
"updated_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.employees": {
"name": "employees",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "employees_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"employee_code": {
"name": "employee_code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"prefix": {
"name": "prefix",
"type": "text",
"primaryKey": false,
"notNull": false
},
"first_name_th": {
"name": "first_name_th",
"type": "text",
"primaryKey": false,
"notNull": false
},
"last_name_th": {
"name": "last_name_th",
"type": "text",
"primaryKey": false,
"notNull": false
},
"first_name_en": {
"name": "first_name_en",
"type": "text",
"primaryKey": false,
"notNull": false
},
"last_name_en": {
"name": "last_name_en",
"type": "text",
"primaryKey": false,
"notNull": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"full_name": {
"name": "full_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"company_name": {
"name": "company_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"company": {
"name": "company",
"type": "text",
"primaryKey": false,
"notNull": false
},
"department_id": {
"name": "department_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"position_id": {
"name": "position_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"hired_at": {
"name": "hired_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'active'"
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"pending_master_review": {
"name": "pending_master_review",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"employees_org_employee_code_idx": {
"name": "employees_org_employee_code_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "employee_code",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"employees_organization_id_organizations_id_fk": {
"name": "employees_organization_id_organizations_id_fk",
"tableFrom": "employees",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"employees_department_id_departments_id_fk": {
"name": "employees_department_id_departments_id_fk",
"tableFrom": "employees",
"tableTo": "departments",
"columnsFrom": [
"department_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"employees_position_id_positions_id_fk": {
"name": "employees_position_id_positions_id_fk",
"tableFrom": "employees",
"tableTo": "positions",
"columnsFrom": [
"position_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.import_jobs": {
"name": "import_jobs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "import_jobs_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"import_type": {
"name": "import_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_name": {
"name": "file_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"total_rows": {
"name": "total_rows",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"success_rows": {
"name": "success_rows",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"failed_rows": {
"name": "failed_rows",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"status": {
"name": "status",
"type": "import_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'processing'"
},
"error_message": {
"name": "error_message",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"import_jobs_organization_id_organizations_id_fk": {
"name": "import_jobs_organization_id_organizations_id_fk",
"tableFrom": "import_jobs",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"import_jobs_created_by_users_id_fk": {
"name": "import_jobs_created_by_users_id_fk",
"tableFrom": "import_jobs",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.memberships": {
"name": "memberships",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "membership_role",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'owner'"
},
"permissions": {
"name": "permissions",
"type": "text[]",
"primaryKey": false,
"notNull": true,
"default": "'{}'"
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"memberships_user_org_idx": {
"name": "memberships_user_org_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"memberships_user_id_users_id_fk": {
"name": "memberships_user_id_users_id_fk",
"tableFrom": "memberships",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"memberships_organization_id_organizations_id_fk": {
"name": "memberships_organization_id_organizations_id_fk",
"tableFrom": "memberships",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.notifications": {
"name": "notifications",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "notifications_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"message": {
"name": "message",
"type": "text",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "notification_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"reference_type": {
"name": "reference_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reference_id": {
"name": "reference_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_read": {
"name": "is_read",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"read_at": {
"name": "read_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"notifications_organization_id_organizations_id_fk": {
"name": "notifications_organization_id_organizations_id_fk",
"tableFrom": "notifications",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"notifications_user_id_users_id_fk": {
"name": "notifications_user_id_users_id_fk",
"tableFrom": "notifications",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.online_lessons": {
"name": "online_lessons",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "online_lessons_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": false
},
"video_url": {
"name": "video_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"video_file_name": {
"name": "video_file_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"video_file_type": {
"name": "video_file_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"video_file_size": {
"name": "video_file_size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"video_storage_key": {
"name": "video_storage_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"video_file_url": {
"name": "video_file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachment_file_name": {
"name": "attachment_file_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachment_file_type": {
"name": "attachment_file_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachment_file_size": {
"name": "attachment_file_size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"attachment_storage_key": {
"name": "attachment_storage_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachment_file_url": {
"name": "attachment_file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"thumbnail_file_name": {
"name": "thumbnail_file_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"thumbnail_file_type": {
"name": "thumbnail_file_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"thumbnail_file_size": {
"name": "thumbnail_file_size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"thumbnail_storage_key": {
"name": "thumbnail_storage_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"thumbnail_url": {
"name": "thumbnail_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "online_lesson_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'draft'"
},
"is_published": {
"name": "is_published",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"published_at": {
"name": "published_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"updated_by": {
"name": "updated_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"online_lessons_organization_id_organizations_id_fk": {
"name": "online_lessons_organization_id_organizations_id_fk",
"tableFrom": "online_lessons",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"online_lessons_created_by_users_id_fk": {
"name": "online_lessons_created_by_users_id_fk",
"tableFrom": "online_lessons",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"online_lessons_updated_by_users_id_fk": {
"name": "online_lessons_updated_by_users_id_fk",
"tableFrom": "online_lessons",
"tableTo": "users",
"columnsFrom": [
"updated_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.organizations": {
"name": "organizations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true
},
"image_url": {
"name": "image_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"plan": {
"name": "plan",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"deleted_at": {
"name": "deleted_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"deleted_by": {
"name": "deleted_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pending_master_review": {
"name": "pending_master_review",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"organizations_slug_idx": {
"name": "organizations_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"organizations_deleted_by_users_id_fk": {
"name": "organizations_deleted_by_users_id_fk",
"tableFrom": "organizations",
"tableTo": "users",
"columnsFrom": [
"deleted_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"organizations_created_by_users_id_fk": {
"name": "organizations_created_by_users_id_fk",
"tableFrom": "organizations",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.permission_audit_logs": {
"name": "permission_audit_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "permission_audit_logs_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"actor_user_id": {
"name": "actor_user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"target_user_id": {
"name": "target_user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"template_id": {
"name": "template_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"assignment_id": {
"name": "assignment_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"override_id": {
"name": "override_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true
},
"reason": {
"name": "reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"before": {
"name": "before",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"after": {
"name": "after",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"permission_audit_logs_organization_id_organizations_id_fk": {
"name": "permission_audit_logs_organization_id_organizations_id_fk",
"tableFrom": "permission_audit_logs",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"permission_audit_logs_actor_user_id_users_id_fk": {
"name": "permission_audit_logs_actor_user_id_users_id_fk",
"tableFrom": "permission_audit_logs",
"tableTo": "users",
"columnsFrom": [
"actor_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"permission_audit_logs_target_user_id_users_id_fk": {
"name": "permission_audit_logs_target_user_id_users_id_fk",
"tableFrom": "permission_audit_logs",
"tableTo": "users",
"columnsFrom": [
"target_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"permission_audit_logs_template_id_permission_templates_id_fk": {
"name": "permission_audit_logs_template_id_permission_templates_id_fk",
"tableFrom": "permission_audit_logs",
"tableTo": "permission_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"permission_audit_logs_assignment_id_user_permission_template_assignments_id_fk": {
"name": "permission_audit_logs_assignment_id_user_permission_template_assignments_id_fk",
"tableFrom": "permission_audit_logs",
"tableTo": "user_permission_template_assignments",
"columnsFrom": [
"assignment_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"permission_audit_logs_override_id_user_permission_overrides_id_fk": {
"name": "permission_audit_logs_override_id_user_permission_overrides_id_fk",
"tableFrom": "permission_audit_logs",
"tableTo": "user_permission_overrides",
"columnsFrom": [
"override_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.permission_template_permissions": {
"name": "permission_template_permissions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "permission_template_permissions_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"template_id": {
"name": "template_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"permission": {
"name": "permission",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"permission_template_permissions_template_permission_idx": {
"name": "permission_template_permissions_template_permission_idx",
"columns": [
{
"expression": "template_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "permission",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"permission_template_permissions_template_id_permission_templates_id_fk": {
"name": "permission_template_permissions_template_id_permission_templates_id_fk",
"tableFrom": "permission_template_permissions",
"tableTo": "permission_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.permission_templates": {
"name": "permission_templates",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "permission_templates_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_system": {
"name": "is_system",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"is_default": {
"name": "is_default",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"deleted_at": {
"name": "deleted_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"updated_by": {
"name": "updated_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"permission_templates_org_code_idx": {
"name": "permission_templates_org_code_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "code",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"permission_templates_org_name_idx": {
"name": "permission_templates_org_name_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"permission_templates_organization_id_organizations_id_fk": {
"name": "permission_templates_organization_id_organizations_id_fk",
"tableFrom": "permission_templates",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"permission_templates_created_by_users_id_fk": {
"name": "permission_templates_created_by_users_id_fk",
"tableFrom": "permission_templates",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"permission_templates_updated_by_users_id_fk": {
"name": "permission_templates_updated_by_users_id_fk",
"tableFrom": "permission_templates",
"tableTo": "users",
"columnsFrom": [
"updated_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.positions": {
"name": "positions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "positions_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"pending_master_review": {
"name": "pending_master_review",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"positions_org_code_idx": {
"name": "positions_org_code_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "code",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"positions_org_name_idx": {
"name": "positions_org_name_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"positions_organization_id_organizations_id_fk": {
"name": "positions_organization_id_organizations_id_fk",
"tableFrom": "positions",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.products": {
"name": "products",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "products_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"photo_url": {
"name": "photo_url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"products_organization_id_organizations_id_fk": {
"name": "products_organization_id_organizations_id_fk",
"tableFrom": "products",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.training_matrices": {
"name": "training_matrices",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "training_matrices_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"department_id": {
"name": "department_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"position_id": {
"name": "position_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"course_id": {
"name": "course_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"is_required": {
"name": "is_required",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"renewal_period_months": {
"name": "renewal_period_months",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"note": {
"name": "note",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"training_matrices_organization_id_organizations_id_fk": {
"name": "training_matrices_organization_id_organizations_id_fk",
"tableFrom": "training_matrices",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"training_matrices_department_id_departments_id_fk": {
"name": "training_matrices_department_id_departments_id_fk",
"tableFrom": "training_matrices",
"tableTo": "departments",
"columnsFrom": [
"department_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"training_matrices_position_id_positions_id_fk": {
"name": "training_matrices_position_id_positions_id_fk",
"tableFrom": "training_matrices",
"tableTo": "positions",
"columnsFrom": [
"position_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"training_matrices_course_id_courses_id_fk": {
"name": "training_matrices_course_id_courses_id_fk",
"tableFrom": "training_matrices",
"tableTo": "courses",
"columnsFrom": [
"course_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.training_policies": {
"name": "training_policies",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "training_policies_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"total_target_minutes": {
"name": "total_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"total_hours": {
"name": "total_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true,
"default": 30
},
"k_target_minutes": {
"name": "k_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"k_hours": {
"name": "k_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true,
"default": 12
},
"s_target_minutes": {
"name": "s_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"s_hours": {
"name": "s_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true,
"default": 12
},
"a_target_minutes": {
"name": "a_target_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"a_hours": {
"name": "a_hours",
"type": "double precision",
"primaryKey": false,
"notNull": true,
"default": 6
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"training_policies_org_year_idx": {
"name": "training_policies_org_year_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "year",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"training_policies_organization_id_organizations_id_fk": {
"name": "training_policies_organization_id_organizations_id_fk",
"tableFrom": "training_policies",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.training_records": {
"name": "training_records",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "training_records_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"employee_id": {
"name": "employee_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"course_id": {
"name": "course_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"course_name": {
"name": "course_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"training_date": {
"name": "training_date",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"training_type": {
"name": "training_type",
"type": "training_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"submitted_minutes": {
"name": "submitted_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"hours": {
"name": "hours",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"approved_minutes": {
"name": "approved_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"approved_hours": {
"name": "approved_hours",
"type": "double precision",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "training_category",
"typeSchema": "public",
"primaryKey": false,
"notNull": false
},
"organizer": {
"name": "organizer",
"type": "text",
"primaryKey": false,
"notNull": false
},
"note": {
"name": "note",
"type": "text",
"primaryKey": false,
"notNull": false
},
"approval_status": {
"name": "approval_status",
"type": "approval_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"reviewer_note": {
"name": "reviewer_note",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reject_reason": {
"name": "reject_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"submitted_by_user_id": {
"name": "submitted_by_user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reviewed_by_user_id": {
"name": "reviewed_by_user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reviewed_by": {
"name": "reviewed_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reviewed_at": {
"name": "reviewed_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"training_records_organization_id_organizations_id_fk": {
"name": "training_records_organization_id_organizations_id_fk",
"tableFrom": "training_records",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"training_records_user_id_users_id_fk": {
"name": "training_records_user_id_users_id_fk",
"tableFrom": "training_records",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"training_records_employee_id_employees_id_fk": {
"name": "training_records_employee_id_employees_id_fk",
"tableFrom": "training_records",
"tableTo": "employees",
"columnsFrom": [
"employee_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"training_records_course_id_courses_id_fk": {
"name": "training_records_course_id_courses_id_fk",
"tableFrom": "training_records",
"tableTo": "courses",
"columnsFrom": [
"course_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"training_records_submitted_by_user_id_users_id_fk": {
"name": "training_records_submitted_by_user_id_users_id_fk",
"tableFrom": "training_records",
"tableTo": "users",
"columnsFrom": [
"submitted_by_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"training_records_reviewed_by_user_id_users_id_fk": {
"name": "training_records_reviewed_by_user_id_users_id_fk",
"tableFrom": "training_records",
"tableTo": "users",
"columnsFrom": [
"reviewed_by_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"training_records_reviewed_by_users_id_fk": {
"name": "training_records_reviewed_by_users_id_fk",
"tableFrom": "training_records",
"tableTo": "users",
"columnsFrom": [
"reviewed_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"training_records_created_by_users_id_fk": {
"name": "training_records_created_by_users_id_fk",
"tableFrom": "training_records",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_employee_maps": {
"name": "user_employee_maps",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "user_employee_maps_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"employee_id": {
"name": "employee_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"provider": {
"name": "provider",
"type": "text",
"primaryKey": false,
"notNull": false
},
"provider_user_id": {
"name": "provider_user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'manual'"
},
"is_primary": {
"name": "is_primary",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"linked_at": {
"name": "linked_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"user_employee_maps_org_user_employee_idx": {
"name": "user_employee_maps_org_user_employee_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "employee_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"user_employee_maps_organization_id_organizations_id_fk": {
"name": "user_employee_maps_organization_id_organizations_id_fk",
"tableFrom": "user_employee_maps",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_employee_maps_user_id_users_id_fk": {
"name": "user_employee_maps_user_id_users_id_fk",
"tableFrom": "user_employee_maps",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_employee_maps_employee_id_employees_id_fk": {
"name": "user_employee_maps_employee_id_employees_id_fk",
"tableFrom": "user_employee_maps",
"tableTo": "employees",
"columnsFrom": [
"employee_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_permission_overrides": {
"name": "user_permission_overrides",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "user_permission_overrides_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"permission": {
"name": "permission",
"type": "text",
"primaryKey": false,
"notNull": true
},
"effect": {
"name": "effect",
"type": "permission_override_effect",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"reason": {
"name": "reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_by": {
"name": "created_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"revoked_by": {
"name": "revoked_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"revoked_at": {
"name": "revoked_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"user_permission_overrides_organization_id_organizations_id_fk": {
"name": "user_permission_overrides_organization_id_organizations_id_fk",
"tableFrom": "user_permission_overrides",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_permission_overrides_user_id_users_id_fk": {
"name": "user_permission_overrides_user_id_users_id_fk",
"tableFrom": "user_permission_overrides",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_permission_overrides_created_by_users_id_fk": {
"name": "user_permission_overrides_created_by_users_id_fk",
"tableFrom": "user_permission_overrides",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"user_permission_overrides_revoked_by_users_id_fk": {
"name": "user_permission_overrides_revoked_by_users_id_fk",
"tableFrom": "user_permission_overrides",
"tableTo": "users",
"columnsFrom": [
"revoked_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_permission_template_assignments": {
"name": "user_permission_template_assignments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "user_permission_template_assignments_id_seq",
"schema": "public",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"organization_id": {
"name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"template_id": {
"name": "template_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"assigned_by": {
"name": "assigned_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"assigned_at": {
"name": "assigned_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"user_permission_template_assignments_org_user_template_idx": {
"name": "user_permission_template_assignments_org_user_template_idx",
"columns": [
{
"expression": "organization_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "template_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"user_permission_template_assignments_organization_id_organizations_id_fk": {
"name": "user_permission_template_assignments_organization_id_organizations_id_fk",
"tableFrom": "user_permission_template_assignments",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_permission_template_assignments_user_id_users_id_fk": {
"name": "user_permission_template_assignments_user_id_users_id_fk",
"tableFrom": "user_permission_template_assignments",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_permission_template_assignments_template_id_permission_templates_id_fk": {
"name": "user_permission_template_assignments_template_id_permission_templates_id_fk",
"tableFrom": "user_permission_template_assignments",
"tableTo": "permission_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"user_permission_template_assignments_assigned_by_users_id_fk": {
"name": "user_permission_template_assignments_assigned_by_users_id_fk",
"tableFrom": "user_permission_template_assignments",
"tableTo": "users",
"columnsFrom": [
"assigned_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": false
},
"password_hash": {
"name": "password_hash",
"type": "text",
"primaryKey": false,
"notNull": false
},
"provider": {
"name": "provider",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'credentials'"
},
"provider_user_id": {
"name": "provider_user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"image": {
"name": "image",
"type": "text",
"primaryKey": false,
"notNull": false
},
"system_role": {
"name": "system_role",
"type": "system_role",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'standard'"
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"employee_code": {
"name": "employee_code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"employee_id": {
"name": "employee_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"department_id": {
"name": "department_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"position_id": {
"name": "position_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"company_name": {
"name": "company_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"hired_at": {
"name": "hired_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"active_organization_id": {
"name": "active_organization_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"last_login_at": {
"name": "last_login_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"users_email_idx": {
"name": "users_email_idx",
"columns": [
{
"expression": "email",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"users_username_idx": {
"name": "users_username_idx",
"columns": [
{
"expression": "username",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"users_provider_user_id_idx": {
"name": "users_provider_user_id_idx",
"columns": [
{
"expression": "provider",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "provider_user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"users_employee_id_employees_id_fk": {
"name": "users_employee_id_employees_id_fk",
"tableFrom": "users",
"tableTo": "employees",
"columnsFrom": [
"employee_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.announcement_status": {
"name": "announcement_status",
"schema": "public",
"values": [
"draft",
"published",
"archived"
]
},
"public.approval_status": {
"name": "approval_status",
"schema": "public",
"values": [
"draft",
"pending",
"approved",
"rejected",
"needs_revision"
]
},
"public.import_status": {
"name": "import_status",
"schema": "public",
"values": [
"processing",
"completed",
"failed"
]
},
"public.membership_role": {
"name": "membership_role",
"schema": "public",
"values": [
"owner",
"admin",
"member"
]
},
"public.notification_type": {
"name": "notification_type",
"schema": "public",
"values": [
"approved",
"rejected",
"announcement",
"reminder"
]
},
"public.online_lesson_status": {
"name": "online_lesson_status",
"schema": "public",
"values": [
"draft",
"published",
"archived"
]
},
"public.permission_override_effect": {
"name": "permission_override_effect",
"schema": "public",
"values": [
"allow",
"deny"
]
},
"public.system_role": {
"name": "system_role",
"schema": "public",
"values": [
"standard",
"super_admin"
]
},
"public.training_category": {
"name": "training_category",
"schema": "public",
"values": [
"K",
"S",
"A"
]
},
"public.training_type": {
"name": "training_type",
"schema": "public",
"values": [
"online",
"onsite",
"internal",
"external"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}