seahaven-ap/packages/api/drizzle/meta/0000_snapshot.json

1150 lines
29 KiB
JSON
Raw Normal View History

{
"id": "5401741c-bdd3-4411-9508-279000503ce6",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.activity_log": {
"name": "activity_log",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"invoice_id": {
"name": "invoice_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"actor_user_id": {
"name": "actor_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"message": {
"name": "message",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"activity_log_invoice_id_invoices_id_fk": {
"name": "activity_log_invoice_id_invoices_id_fk",
"tableFrom": "activity_log",
"tableTo": "invoices",
"columnsFrom": [
"invoice_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"activity_log_actor_user_id_users_id_fk": {
"name": "activity_log_actor_user_id_users_id_fk",
"tableFrom": "activity_log",
"tableTo": "users",
"columnsFrom": [
"actor_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.approval_policies": {
"name": "approval_policies",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"priority": {
"name": "priority",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 100
},
"amount_threshold": {
"name": "amount_threshold",
"type": "numeric(14, 2)",
"primaryKey": false,
"notNull": false
},
"skip_below_amount": {
"name": "skip_below_amount",
"type": "numeric(14, 2)",
"primaryKey": false,
"notNull": false
},
"active": {
"name": "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": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.approval_steps": {
"name": "approval_steps",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"invoice_id": {
"name": "invoice_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"policy_id": {
"name": "policy_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"step_order": {
"name": "step_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 1
},
"approver_role": {
"name": "approver_role",
"type": "user_role",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'approver'"
},
"assignee_user_id": {
"name": "assignee_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "approval_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"acted_by_user_id": {
"name": "acted_by_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"acted_at": {
"name": "acted_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": {
"approval_steps_invoice_id_invoices_id_fk": {
"name": "approval_steps_invoice_id_invoices_id_fk",
"tableFrom": "approval_steps",
"tableTo": "invoices",
"columnsFrom": [
"invoice_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"approval_steps_policy_id_approval_policies_id_fk": {
"name": "approval_steps_policy_id_approval_policies_id_fk",
"tableFrom": "approval_steps",
"tableTo": "approval_policies",
"columnsFrom": [
"policy_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"approval_steps_assignee_user_id_users_id_fk": {
"name": "approval_steps_assignee_user_id_users_id_fk",
"tableFrom": "approval_steps",
"tableTo": "users",
"columnsFrom": [
"assignee_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"approval_steps_acted_by_user_id_users_id_fk": {
"name": "approval_steps_acted_by_user_id_users_id_fk",
"tableFrom": "approval_steps",
"tableTo": "users",
"columnsFrom": [
"acted_by_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.departments": {
"name": "departments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"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": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.documents": {
"name": "documents",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"invoice_id": {
"name": "invoice_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"object_key": {
"name": "object_key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content_type": {
"name": "content_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'application/pdf'"
},
"file_name": {
"name": "file_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"uploaded_by_user_id": {
"name": "uploaded_by_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"documents_invoice_id_invoices_id_fk": {
"name": "documents_invoice_id_invoices_id_fk",
"tableFrom": "documents",
"tableTo": "invoices",
"columnsFrom": [
"invoice_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"documents_uploaded_by_user_id_users_id_fk": {
"name": "documents_uploaded_by_user_id_users_id_fk",
"tableFrom": "documents",
"tableTo": "users",
"columnsFrom": [
"uploaded_by_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.gl_accounts": {
"name": "gl_accounts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"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": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.invoice_comments": {
"name": "invoice_comments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"invoice_id": {
"name": "invoice_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"author_user_id": {
"name": "author_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"invoice_comments_invoice_id_invoices_id_fk": {
"name": "invoice_comments_invoice_id_invoices_id_fk",
"tableFrom": "invoice_comments",
"tableTo": "invoices",
"columnsFrom": [
"invoice_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"invoice_comments_author_user_id_users_id_fk": {
"name": "invoice_comments_author_user_id_users_id_fk",
"tableFrom": "invoice_comments",
"tableTo": "users",
"columnsFrom": [
"author_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.invoice_lines": {
"name": "invoice_lines",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"invoice_id": {
"name": "invoice_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"amount": {
"name": "amount",
"type": "numeric(14, 2)",
"primaryKey": false,
"notNull": true
},
"gl_account_id": {
"name": "gl_account_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"department_id": {
"name": "department_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"invoice_lines_invoice_id_invoices_id_fk": {
"name": "invoice_lines_invoice_id_invoices_id_fk",
"tableFrom": "invoice_lines",
"tableTo": "invoices",
"columnsFrom": [
"invoice_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"invoice_lines_gl_account_id_gl_accounts_id_fk": {
"name": "invoice_lines_gl_account_id_gl_accounts_id_fk",
"tableFrom": "invoice_lines",
"tableTo": "gl_accounts",
"columnsFrom": [
"gl_account_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"invoice_lines_department_id_departments_id_fk": {
"name": "invoice_lines_department_id_departments_id_fk",
"tableFrom": "invoice_lines",
"tableTo": "departments",
"columnsFrom": [
"department_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.invoices": {
"name": "invoices",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"vendor_id": {
"name": "vendor_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"invoice_number": {
"name": "invoice_number",
"type": "text",
"primaryKey": false,
"notNull": true
},
"amount": {
"name": "amount",
"type": "numeric(14, 2)",
"primaryKey": false,
"notNull": true
},
"amount_due": {
"name": "amount_due",
"type": "numeric(14, 2)",
"primaryKey": false,
"notNull": true
},
"due_date": {
"name": "due_date",
"type": "text",
"primaryKey": false,
"notNull": true
},
"pay_date": {
"name": "pay_date",
"type": "text",
"primaryKey": false,
"notNull": false
},
"send_payment_on": {
"name": "send_payment_on",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "invoice_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pending_approval'"
},
"payment_method": {
"name": "payment_method",
"type": "payment_method",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'check'"
},
"memo": {
"name": "memo",
"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": {
"invoices_vendor_number_active_uidx": {
"name": "invoices_vendor_number_active_uidx",
"columns": [
{
"expression": "vendor_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "invoice_number",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"where": "\"invoices\".\"status\" <> 'void'",
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"invoices_vendor_id_vendors_id_fk": {
"name": "invoices_vendor_id_vendors_id_fk",
"tableFrom": "invoices",
"tableTo": "vendors",
"columnsFrom": [
"vendor_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pay_runs": {
"name": "pay_runs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"created_by_user_id": {
"name": "created_by_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'draft'"
},
"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": {
"pay_runs_created_by_user_id_users_id_fk": {
"name": "pay_runs_created_by_user_id_users_id_fk",
"tableFrom": "pay_runs",
"tableTo": "users",
"columnsFrom": [
"created_by_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.payments": {
"name": "payments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"pay_run_id": {
"name": "pay_run_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"invoice_id": {
"name": "invoice_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"vendor_id": {
"name": "vendor_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"amount": {
"name": "amount",
"type": "numeric(14, 2)",
"primaryKey": false,
"notNull": true
},
"payment_method": {
"name": "payment_method",
"type": "payment_method",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'check'"
},
"check_number": {
"name": "check_number",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "payment_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'scheduled'"
},
"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": {
"payments_pay_run_id_pay_runs_id_fk": {
"name": "payments_pay_run_id_pay_runs_id_fk",
"tableFrom": "payments",
"tableTo": "pay_runs",
"columnsFrom": [
"pay_run_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"payments_invoice_id_invoices_id_fk": {
"name": "payments_invoice_id_invoices_id_fk",
"tableFrom": "payments",
"tableTo": "invoices",
"columnsFrom": [
"invoice_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"payments_vendor_id_vendors_id_fk": {
"name": "payments_vendor_id_vendors_id_fk",
"tableFrom": "payments",
"tableTo": "vendors",
"columnsFrom": [
"vendor_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"cognito_sub": {
"name": "cognito_sub",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "user_role",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'viewer'"
},
"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_cognito_sub_uidx": {
"name": "users_cognito_sub_uidx",
"columns": [
{
"expression": "cognito_sub",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"users_email_uidx": {
"name": "users_email_uidx",
"columns": [
{
"expression": "email",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.vendors": {
"name": "vendors",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"default_payment_method": {
"name": "default_payment_method",
"type": "payment_method",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'check'"
},
"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": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.approval_status": {
"name": "approval_status",
"schema": "public",
"values": [
"pending",
"approved",
"rejected",
"skipped"
]
},
"public.invoice_status": {
"name": "invoice_status",
"schema": "public",
"values": [
"pending_approval",
"approved",
"scheduled",
"paid",
"rejected",
"void"
]
},
"public.payment_method": {
"name": "payment_method",
"schema": "public",
"values": [
"check",
"ach"
]
},
"public.payment_status": {
"name": "payment_status",
"schema": "public",
"values": [
"scheduled",
"payment_submitted",
"issued",
"outstanding",
"cleared"
]
},
"public.user_role": {
"name": "user_role",
"schema": "public",
"values": [
"admin",
"ap_processor",
"approver",
"viewer"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}