arcadiasuite/migrations/meta/0000_snapshot.json

30870 lines
799 KiB
JSON

{
"id": "1c593655-e3e7-40ad-ad23-7a12bea3a796",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.activity_feed": {
"name": "activity_feed",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"actor_id": {
"name": "actor_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"module": {
"name": "module",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity_type": {
"name": "entity_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity_id": {
"name": "entity_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity_title": {
"name": "entity_title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_read": {
"name": "is_read",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"activity_feed_user_id_users_id_fk": {
"name": "activity_feed_user_id_users_id_fk",
"tableFrom": "activity_feed",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"activity_feed_actor_id_users_id_fk": {
"name": "activity_feed_actor_id_users_id_fk",
"tableFrom": "activity_feed",
"tableTo": "users",
"columnsFrom": [
"actor_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.agent_tasks": {
"name": "agent_tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"schedule": {
"name": "schedule",
"type": "text",
"primaryKey": false,
"notNull": false
},
"erp_connection_id": {
"name": "erp_connection_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"config": {
"name": "config",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"last_run": {
"name": "last_run",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"next_run": {
"name": "next_run",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"agent_tasks_erp_connection_id_erp_connections_id_fk": {
"name": "agent_tasks_erp_connection_id_erp_connections_id_fk",
"tableFrom": "agent_tasks",
"tableTo": "erp_connections",
"columnsFrom": [
"erp_connection_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.applications": {
"name": "applications",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.arc_doctypes": {
"name": "arc_doctypes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"label": {
"name": "label",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"module": {
"name": "module",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"icon": {
"name": "icon",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'FileText'"
},
"color": {
"name": "color",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'blue'"
},
"is_submittable": {
"name": "is_submittable",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"is_child": {
"name": "is_child",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"parent_doctype_id": {
"name": "parent_doctype_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_single": {
"name": "is_single",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"is_tree": {
"name": "is_tree",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"track_changes": {
"name": "track_changes",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"allow_import": {
"name": "allow_import",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"allow_export": {
"name": "allow_export",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"has_web_view": {
"name": "has_web_view",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"permissions": {
"name": "permissions",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"hooks": {
"name": "hooks",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"arc_doctypes_tenant_id_tenants_id_fk": {
"name": "arc_doctypes_tenant_id_tenants_id_fk",
"tableFrom": "arc_doctypes",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.arc_fields": {
"name": "arc_fields",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"doctype_id": {
"name": "doctype_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"field_name": {
"name": "field_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"label": {
"name": "label",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"field_type": {
"name": "field_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"options": {
"name": "options",
"type": "text",
"primaryKey": false,
"notNull": false
},
"default_value": {
"name": "default_value",
"type": "text",
"primaryKey": false,
"notNull": false
},
"mandatory": {
"name": "mandatory",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"unique": {
"name": "unique",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"read_only": {
"name": "read_only",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"hidden": {
"name": "hidden",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"in_list_view": {
"name": "in_list_view",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"in_filter": {
"name": "in_filter",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"searchable": {
"name": "searchable",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"section": {
"name": "section",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"column": {
"name": "column",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"width": {
"name": "width",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"placeholder": {
"name": "placeholder",
"type": "text",
"primaryKey": false,
"notNull": false
},
"help_text": {
"name": "help_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"validation": {
"name": "validation",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"depends_on": {
"name": "depends_on",
"type": "text",
"primaryKey": false,
"notNull": false
},
"fetch_from": {
"name": "fetch_from",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"arc_fields_doctype_id_arc_doctypes_id_fk": {
"name": "arc_fields_doctype_id_arc_doctypes_id_fk",
"tableFrom": "arc_fields",
"tableTo": "arc_doctypes",
"columnsFrom": [
"doctype_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.arc_layouts": {
"name": "arc_layouts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"layout_type": {
"name": "layout_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'form'"
},
"config": {
"name": "config",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"is_default": {
"name": "is_default",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"arc_layouts_tenant_id_tenants_id_fk": {
"name": "arc_layouts_tenant_id_tenants_id_fk",
"tableFrom": "arc_layouts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.arc_pages": {
"name": "arc_pages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"route": {
"name": "route",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"page_type": {
"name": "page_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'page'"
},
"doctype_id": {
"name": "doctype_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"icon": {
"name": "icon",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"module": {
"name": "module",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"roles": {
"name": "roles",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"layout": {
"name": "layout",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"script": {
"name": "script",
"type": "text",
"primaryKey": false,
"notNull": false
},
"style": {
"name": "style",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"arc_pages_tenant_id_tenants_id_fk": {
"name": "arc_pages_tenant_id_tenants_id_fk",
"tableFrom": "arc_pages",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"arc_pages_doctype_id_arc_doctypes_id_fk": {
"name": "arc_pages_doctype_id_arc_doctypes_id_fk",
"tableFrom": "arc_pages",
"tableTo": "arc_doctypes",
"columnsFrom": [
"doctype_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.arc_scripts": {
"name": "arc_scripts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"doctype_id": {
"name": "doctype_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"script_type": {
"name": "script_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"trigger_event": {
"name": "trigger_event",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"script": {
"name": "script",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_enabled": {
"name": "is_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"arc_scripts_tenant_id_tenants_id_fk": {
"name": "arc_scripts_tenant_id_tenants_id_fk",
"tableFrom": "arc_scripts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"arc_scripts_doctype_id_arc_doctypes_id_fk": {
"name": "arc_scripts_doctype_id_arc_doctypes_id_fk",
"tableFrom": "arc_scripts",
"tableTo": "arc_doctypes",
"columnsFrom": [
"doctype_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.arc_widgets": {
"name": "arc_widgets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"label": {
"name": "label",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"widget_type": {
"name": "widget_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"icon": {
"name": "icon",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"config": {
"name": "config",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"data_source": {
"name": "data_source",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"is_system": {
"name": "is_system",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"arc_widgets_tenant_id_tenants_id_fk": {
"name": "arc_widgets_tenant_id_tenants_id_fk",
"tableFrom": "arc_widgets",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.arc_workflows": {
"name": "arc_workflows",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"nodes": {
"name": "nodes",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"arc_workflows_tenant_id_tenants_id_fk": {
"name": "arc_workflows_tenant_id_tenants_id_fk",
"tableFrom": "arc_workflows",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.automation_actions": {
"name": "automation_actions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"automation_id": {
"name": "automation_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"action_type": {
"name": "action_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"action_config": {
"name": "action_config",
"type": "text",
"primaryKey": false,
"notNull": false
},
"condition_config": {
"name": "condition_config",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"automation_actions_automation_id_automations_id_fk": {
"name": "automation_actions_automation_id_automations_id_fk",
"tableFrom": "automation_actions",
"tableTo": "automations",
"columnsFrom": [
"automation_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.automation_logs": {
"name": "automation_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"automation_id": {
"name": "automation_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true
},
"trigger_data": {
"name": "trigger_data",
"type": "text",
"primaryKey": false,
"notNull": false
},
"result": {
"name": "result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"error": {
"name": "error",
"type": "text",
"primaryKey": false,
"notNull": false
},
"started_at": {
"name": "started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"automation_logs_automation_id_automations_id_fk": {
"name": "automation_logs_automation_id_automations_id_fk",
"tableFrom": "automation_logs",
"tableTo": "automations",
"columnsFrom": [
"automation_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.automations": {
"name": "automations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"trigger_type": {
"name": "trigger_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"trigger_config": {
"name": "trigger_config",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"automations_user_id_users_id_fk": {
"name": "automations_user_id_users_id_fk",
"tableFrom": "automations",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.backup_artifacts": {
"name": "backup_artifacts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"backup_job_id": {
"name": "backup_job_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"automation_log_id": {
"name": "automation_log_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"filename": {
"name": "filename",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_path": {
"name": "file_path",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_size": {
"name": "file_size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"checksum": {
"name": "checksum",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"started_at": {
"name": "started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"backup_artifacts_backup_job_id_backup_jobs_id_fk": {
"name": "backup_artifacts_backup_job_id_backup_jobs_id_fk",
"tableFrom": "backup_artifacts",
"tableTo": "backup_jobs",
"columnsFrom": [
"backup_job_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"backup_artifacts_automation_log_id_automation_logs_id_fk": {
"name": "backup_artifacts_automation_log_id_automation_logs_id_fk",
"tableFrom": "backup_artifacts",
"tableTo": "automation_logs",
"columnsFrom": [
"automation_log_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.backup_jobs": {
"name": "backup_jobs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"data_source_id": {
"name": "data_source_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"backup_type": {
"name": "backup_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"include_schema": {
"name": "include_schema",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"include_tables": {
"name": "include_tables",
"type": "text",
"primaryKey": false,
"notNull": false
},
"exclude_tables": {
"name": "exclude_tables",
"type": "text",
"primaryKey": false,
"notNull": false
},
"compression_type": {
"name": "compression_type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'gzip'"
},
"retention_days": {
"name": "retention_days",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 30
},
"storage_location": {
"name": "storage_location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"backup_jobs_user_id_users_id_fk": {
"name": "backup_jobs_user_id_users_id_fk",
"tableFrom": "backup_jobs",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"backup_jobs_data_source_id_data_sources_id_fk": {
"name": "backup_jobs_data_source_id_data_sources_id_fk",
"tableFrom": "backup_jobs",
"tableTo": "data_sources",
"columnsFrom": [
"data_source_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.bi_charts": {
"name": "bi_charts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"dataset_id": {
"name": "dataset_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"chart_type": {
"name": "chart_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"config": {
"name": "config",
"type": "text",
"primaryKey": false,
"notNull": false
},
"x_axis": {
"name": "x_axis",
"type": "text",
"primaryKey": false,
"notNull": false
},
"y_axis": {
"name": "y_axis",
"type": "text",
"primaryKey": false,
"notNull": false
},
"group_by": {
"name": "group_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"aggregation": {
"name": "aggregation",
"type": "text",
"primaryKey": false,
"notNull": false
},
"colors": {
"name": "colors",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"bi_charts_user_id_users_id_fk": {
"name": "bi_charts_user_id_users_id_fk",
"tableFrom": "bi_charts",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"bi_charts_dataset_id_bi_datasets_id_fk": {
"name": "bi_charts_dataset_id_bi_datasets_id_fk",
"tableFrom": "bi_charts",
"tableTo": "bi_datasets",
"columnsFrom": [
"dataset_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.bi_dashboard_charts": {
"name": "bi_dashboard_charts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"dashboard_id": {
"name": "dashboard_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"position_x": {
"name": "position_x",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"position_y": {
"name": "position_y",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"width": {
"name": "width",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 6
},
"height": {
"name": "height",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 4
}
},
"indexes": {},
"foreignKeys": {
"bi_dashboard_charts_dashboard_id_bi_dashboards_id_fk": {
"name": "bi_dashboard_charts_dashboard_id_bi_dashboards_id_fk",
"tableFrom": "bi_dashboard_charts",
"tableTo": "bi_dashboards",
"columnsFrom": [
"dashboard_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"bi_dashboard_charts_chart_id_bi_charts_id_fk": {
"name": "bi_dashboard_charts_chart_id_bi_charts_id_fk",
"tableFrom": "bi_dashboard_charts",
"tableTo": "bi_charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.bi_dashboards": {
"name": "bi_dashboards",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"layout": {
"name": "layout",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"bi_dashboards_user_id_users_id_fk": {
"name": "bi_dashboards_user_id_users_id_fk",
"tableFrom": "bi_dashboards",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.bi_datasets": {
"name": "bi_datasets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"data_source_id": {
"name": "data_source_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"query_type": {
"name": "query_type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'table'"
},
"table_name": {
"name": "table_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sql_query": {
"name": "sql_query",
"type": "text",
"primaryKey": false,
"notNull": false
},
"columns": {
"name": "columns",
"type": "text",
"primaryKey": false,
"notNull": false
},
"filters": {
"name": "filters",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"bi_datasets_user_id_users_id_fk": {
"name": "bi_datasets_user_id_users_id_fk",
"tableFrom": "bi_datasets",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"bi_datasets_data_source_id_data_sources_id_fk": {
"name": "bi_datasets_data_source_id_data_sources_id_fk",
"tableFrom": "bi_datasets",
"tableTo": "data_sources",
"columnsFrom": [
"data_source_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_attachments": {
"name": "chat_attachments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"message_id": {
"name": "message_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"file_name": {
"name": "file_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_type": {
"name": "file_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"file_content": {
"name": "file_content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"chat_attachments_message_id_messages_id_fk": {
"name": "chat_attachments_message_id_messages_id_fk",
"tableFrom": "chat_attachments",
"tableTo": "messages",
"columnsFrom": [
"message_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_messages": {
"name": "chat_messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"thread_id": {
"name": "thread_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"sender_id": {
"name": "sender_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": true
},
"message_type": {
"name": "message_type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'text'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'sent'"
},
"sent_at": {
"name": "sent_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"edited_at": {
"name": "edited_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"chat_messages_thread_id_chat_threads_id_fk": {
"name": "chat_messages_thread_id_chat_threads_id_fk",
"tableFrom": "chat_messages",
"tableTo": "chat_threads",
"columnsFrom": [
"thread_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"chat_messages_sender_id_users_id_fk": {
"name": "chat_messages_sender_id_users_id_fk",
"tableFrom": "chat_messages",
"tableTo": "users",
"columnsFrom": [
"sender_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_participants": {
"name": "chat_participants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"thread_id": {
"name": "thread_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'member'"
},
"joined_at": {
"name": "joined_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"last_read_at": {
"name": "last_read_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"chat_participants_thread_id_chat_threads_id_fk": {
"name": "chat_participants_thread_id_chat_threads_id_fk",
"tableFrom": "chat_participants",
"tableTo": "chat_threads",
"columnsFrom": [
"thread_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"chat_participants_user_id_users_id_fk": {
"name": "chat_participants_user_id_users_id_fk",
"tableFrom": "chat_participants",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_threads": {
"name": "chat_threads",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'direct'"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"latest_message_at": {
"name": "latest_message_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"chat_threads_created_by_users_id_fk": {
"name": "chat_threads_created_by_users_id_fk",
"tableFrom": "chat_threads",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.command_history": {
"name": "command_history",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"command": {
"name": "command",
"type": "text",
"primaryKey": false,
"notNull": true
},
"frequency": {
"name": "frequency",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"last_used_at": {
"name": "last_used_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"command_history_user_id_users_id_fk": {
"name": "command_history_user_id_users_id_fk",
"tableFrom": "command_history",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.communities": {
"name": "communities",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"icon_emoji": {
"name": "icon_emoji",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false,
"default": "'🏢'"
},
"icon_color": {
"name": "icon_color",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'#3b82f6'"
},
"is_private": {
"name": "is_private",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"communities_tenant_id_tenants_id_fk": {
"name": "communities_tenant_id_tenants_id_fk",
"tableFrom": "communities",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"communities_created_by_users_id_fk": {
"name": "communities_created_by_users_id_fk",
"tableFrom": "communities",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.community_channels": {
"name": "community_channels",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"community_id": {
"name": "community_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'text'"
},
"is_private": {
"name": "is_private",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"community_channels_community_id_communities_id_fk": {
"name": "community_channels_community_id_communities_id_fk",
"tableFrom": "community_channels",
"tableTo": "communities",
"columnsFrom": [
"community_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.community_members": {
"name": "community_members",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"community_id": {
"name": "community_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'member'"
},
"nickname": {
"name": "nickname",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'offline'"
},
"status_message": {
"name": "status_message",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"joined_at": {
"name": "joined_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"last_active_at": {
"name": "last_active_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"community_members_community_id_communities_id_fk": {
"name": "community_members_community_id_communities_id_fk",
"tableFrom": "community_members",
"tableTo": "communities",
"columnsFrom": [
"community_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"community_members_user_id_users_id_fk": {
"name": "community_members_user_id_users_id_fk",
"tableFrom": "community_members",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.community_messages": {
"name": "community_messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"channel_id": {
"name": "channel_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"reply_to_id": {
"name": "reply_to_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_pinned": {
"name": "is_pinned",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"edited_at": {
"name": "edited_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"deleted_at": {
"name": "deleted_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"community_messages_channel_id_community_channels_id_fk": {
"name": "community_messages_channel_id_community_channels_id_fk",
"tableFrom": "community_messages",
"tableTo": "community_channels",
"columnsFrom": [
"channel_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"community_messages_user_id_users_id_fk": {
"name": "community_messages_user_id_users_id_fk",
"tableFrom": "community_messages",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.contabil_centros_custo": {
"name": "contabil_centros_custo",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"centro_pai": {
"name": "centro_pai",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"responsavel": {
"name": "responsavel",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.contabil_config_lancamento": {
"name": "contabil_config_lancamento",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"origem": {
"name": "origem",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"conta_debito": {
"name": "conta_debito",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"conta_credito": {
"name": "conta_credito",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"centro_custo": {
"name": "centro_custo",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"historico_template": {
"name": "historico_template",
"type": "text",
"primaryKey": false,
"notNull": false
},
"ativo": {
"name": "ativo",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"contabil_config_lancamento_conta_debito_contabil_plano_contas_id_fk": {
"name": "contabil_config_lancamento_conta_debito_contabil_plano_contas_id_fk",
"tableFrom": "contabil_config_lancamento",
"tableTo": "contabil_plano_contas",
"columnsFrom": [
"conta_debito"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"contabil_config_lancamento_conta_credito_contabil_plano_contas_id_fk": {
"name": "contabil_config_lancamento_conta_credito_contabil_plano_contas_id_fk",
"tableFrom": "contabil_config_lancamento",
"tableTo": "contabil_plano_contas",
"columnsFrom": [
"conta_credito"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"contabil_config_lancamento_centro_custo_contabil_centros_custo_id_fk": {
"name": "contabil_config_lancamento_centro_custo_contabil_centros_custo_id_fk",
"tableFrom": "contabil_config_lancamento",
"tableTo": "contabil_centros_custo",
"columnsFrom": [
"centro_custo"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.contabil_lancamentos": {
"name": "contabil_lancamentos",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"numero": {
"name": "numero",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"data_lancamento": {
"name": "data_lancamento",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"data_competencia": {
"name": "data_competencia",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"tipo_documento": {
"name": "tipo_documento",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"numero_documento": {
"name": "numero_documento",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"historico": {
"name": "historico",
"type": "text",
"primaryKey": false,
"notNull": true
},
"valor": {
"name": "valor",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"origem": {
"name": "origem",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"origem_id": {
"name": "origem_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pendente'"
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"contabil_lancamentos_created_by_users_id_fk": {
"name": "contabil_lancamentos_created_by_users_id_fk",
"tableFrom": "contabil_lancamentos",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.contabil_partidas": {
"name": "contabil_partidas",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"lancamento_id": {
"name": "lancamento_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"conta_id": {
"name": "conta_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"centro_custo_id": {
"name": "centro_custo_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"tipo": {
"name": "tipo",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
},
"valor": {
"name": "valor",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"historico": {
"name": "historico",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"contabil_partidas_lancamento_id_contabil_lancamentos_id_fk": {
"name": "contabil_partidas_lancamento_id_contabil_lancamentos_id_fk",
"tableFrom": "contabil_partidas",
"tableTo": "contabil_lancamentos",
"columnsFrom": [
"lancamento_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"contabil_partidas_conta_id_contabil_plano_contas_id_fk": {
"name": "contabil_partidas_conta_id_contabil_plano_contas_id_fk",
"tableFrom": "contabil_partidas",
"tableTo": "contabil_plano_contas",
"columnsFrom": [
"conta_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"contabil_partidas_centro_custo_id_contabil_centros_custo_id_fk": {
"name": "contabil_partidas_centro_custo_id_contabil_centros_custo_id_fk",
"tableFrom": "contabil_partidas",
"tableTo": "contabil_centros_custo",
"columnsFrom": [
"centro_custo_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.contabil_periodos": {
"name": "contabil_periodos",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"ano": {
"name": "ano",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"mes": {
"name": "mes",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"data_inicio": {
"name": "data_inicio",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"data_fim": {
"name": "data_fim",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'aberto'"
},
"fechado_por": {
"name": "fechado_por",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"fechado_em": {
"name": "fechado_em",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"contabil_periodos_fechado_por_users_id_fk": {
"name": "contabil_periodos_fechado_por_users_id_fk",
"tableFrom": "contabil_periodos",
"tableTo": "users",
"columnsFrom": [
"fechado_por"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.contabil_plano_contas": {
"name": "contabil_plano_contas",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"natureza": {
"name": "natureza",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
},
"nivel": {
"name": "nivel",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"conta_pai": {
"name": "conta_pai",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"aceita_lancamento": {
"name": "aceita_lancamento",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"codigo_reduzido": {
"name": "codigo_reduzido",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.contabil_saldos": {
"name": "contabil_saldos",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"conta_id": {
"name": "conta_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"centro_custo_id": {
"name": "centro_custo_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"ano": {
"name": "ano",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"mes": {
"name": "mes",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"saldo_anterior": {
"name": "saldo_anterior",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"debitos": {
"name": "debitos",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"creditos": {
"name": "creditos",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"saldo_atual": {
"name": "saldo_atual",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"contabil_saldos_conta_id_contabil_plano_contas_id_fk": {
"name": "contabil_saldos_conta_id_contabil_plano_contas_id_fk",
"tableFrom": "contabil_saldos",
"tableTo": "contabil_plano_contas",
"columnsFrom": [
"conta_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"contabil_saldos_centro_custo_id_contabil_centros_custo_id_fk": {
"name": "contabil_saldos_centro_custo_id_contabil_centros_custo_id_fk",
"tableFrom": "contabil_saldos",
"tableTo": "contabil_centros_custo",
"columnsFrom": [
"centro_custo_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.conversations": {
"name": "conversations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"conversations_user_id_users_id_fk": {
"name": "conversations_user_id_users_id_fk",
"tableFrom": "conversations",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_campaign_contacts": {
"name": "crm_campaign_contacts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"campaign_id": {
"name": "campaign_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"sent_at": {
"name": "sent_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"delivered_at": {
"name": "delivered_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"read_at": {
"name": "read_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"error_message": {
"name": "error_message",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"crm_campaign_contacts_campaign_id_crm_campaigns_id_fk": {
"name": "crm_campaign_contacts_campaign_id_crm_campaigns_id_fk",
"tableFrom": "crm_campaign_contacts",
"tableTo": "crm_campaigns",
"columnsFrom": [
"campaign_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_campaigns": {
"name": "crm_campaigns",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"message_content": {
"name": "message_content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"media_url": {
"name": "media_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"scheduled_at": {
"name": "scheduled_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"started_at": {
"name": "started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"total_contacts": {
"name": "total_contacts",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"sent_count": {
"name": "sent_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"delivered_count": {
"name": "delivered_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"read_count": {
"name": "read_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"failed_count": {
"name": "failed_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_by_id": {
"name": "created_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_campaigns_tenant_id_tenants_id_fk": {
"name": "crm_campaigns_tenant_id_tenants_id_fk",
"tableFrom": "crm_campaigns",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_campaigns_channel_id_crm_channels_id_fk": {
"name": "crm_campaigns_channel_id_crm_channels_id_fk",
"tableFrom": "crm_campaigns",
"tableTo": "crm_channels",
"columnsFrom": [
"channel_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_campaigns_created_by_id_users_id_fk": {
"name": "crm_campaigns_created_by_id_users_id_fk",
"tableFrom": "crm_campaigns",
"tableTo": "users",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_channels": {
"name": "crm_channels",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"identifier": {
"name": "identifier",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'disconnected'"
},
"session_data": {
"name": "session_data",
"type": "text",
"primaryKey": false,
"notNull": false
},
"qr_code": {
"name": "qr_code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"last_connected_at": {
"name": "last_connected_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_channels_tenant_id_tenants_id_fk": {
"name": "crm_channels_tenant_id_tenants_id_fk",
"tableFrom": "crm_channels",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_clients": {
"name": "crm_clients",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"trade_name": {
"name": "trade_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"cnpj": {
"name": "cnpj",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"website": {
"name": "website",
"type": "text",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "text",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "text",
"primaryKey": false,
"notNull": false
},
"segment": {
"name": "segment",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_contact_name": {
"name": "primary_contact_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_contact_email": {
"name": "primary_contact_email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_contact_phone": {
"name": "primary_contact_phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"converted_from_lead_id": {
"name": "converted_from_lead_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"converted_from_partner_id": {
"name": "converted_from_partner_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_clients_tenant_id_tenants_id_fk": {
"name": "crm_clients_tenant_id_tenants_id_fk",
"tableFrom": "crm_clients",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_clients_user_id_users_id_fk": {
"name": "crm_clients_user_id_users_id_fk",
"tableFrom": "crm_clients",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_commission_rules": {
"name": "crm_commission_rules",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"revenue_type": {
"name": "revenue_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"sale_scenario": {
"name": "sale_scenario",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false
},
"month_range_start": {
"name": "month_range_start",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"month_range_end": {
"name": "month_range_end",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"percentage": {
"name": "percentage",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_commissions": {
"name": "crm_commissions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"contract_id": {
"name": "contract_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"revenue_schedule_id": {
"name": "revenue_schedule_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"rule_id": {
"name": "rule_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false
},
"base_value": {
"name": "base_value",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"percentage": {
"name": "percentage",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"commission_value": {
"name": "commission_value",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"period": {
"name": "period",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"paid_at": {
"name": "paid_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_commissions_contract_id_crm_contracts_id_fk": {
"name": "crm_commissions_contract_id_crm_contracts_id_fk",
"tableFrom": "crm_commissions",
"tableTo": "crm_contracts",
"columnsFrom": [
"contract_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_commissions_revenue_schedule_id_crm_revenue_schedule_id_fk": {
"name": "crm_commissions_revenue_schedule_id_crm_revenue_schedule_id_fk",
"tableFrom": "crm_commissions",
"tableTo": "crm_revenue_schedule",
"columnsFrom": [
"revenue_schedule_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_commissions_rule_id_crm_commission_rules_id_fk": {
"name": "crm_commissions_rule_id_crm_commission_rules_id_fk",
"tableFrom": "crm_commissions",
"tableTo": "crm_commission_rules",
"columnsFrom": [
"rule_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_commissions_partner_id_crm_partners_id_fk": {
"name": "crm_commissions_partner_id_crm_partners_id_fk",
"tableFrom": "crm_commissions",
"tableTo": "crm_partners",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_commissions_user_id_users_id_fk": {
"name": "crm_commissions_user_id_users_id_fk",
"tableFrom": "crm_commissions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_contract_milestones": {
"name": "crm_contract_milestones",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"contract_id": {
"name": "contract_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_date": {
"name": "completed_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"deliverables": {
"name": "deliverables",
"type": "text",
"primaryKey": false,
"notNull": false
},
"billing_amount": {
"name": "billing_amount",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"billing_status": {
"name": "billing_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_contract_milestones_contract_id_crm_contracts_id_fk": {
"name": "crm_contract_milestones_contract_id_crm_contracts_id_fk",
"tableFrom": "crm_contract_milestones",
"tableTo": "crm_contracts",
"columnsFrom": [
"contract_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_contracts": {
"name": "crm_contracts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"opportunity_id": {
"name": "opportunity_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"contract_number": {
"name": "contract_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"start_date": {
"name": "start_date",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"end_date": {
"name": "end_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"monthly_value": {
"name": "monthly_value",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"total_value": {
"name": "total_value",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"payment_terms": {
"name": "payment_terms",
"type": "text",
"primaryKey": false,
"notNull": false
},
"billing_cycle": {
"name": "billing_cycle",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'monthly'"
},
"auto_renew": {
"name": "auto_renew",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"signed_at": {
"name": "signed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"signed_by": {
"name": "signed_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_contracts_tenant_id_tenants_id_fk": {
"name": "crm_contracts_tenant_id_tenants_id_fk",
"tableFrom": "crm_contracts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_contracts_client_id_pc_clients_id_fk": {
"name": "crm_contracts_client_id_pc_clients_id_fk",
"tableFrom": "crm_contracts",
"tableTo": "pc_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_contracts_partner_id_crm_partners_id_fk": {
"name": "crm_contracts_partner_id_crm_partners_id_fk",
"tableFrom": "crm_contracts",
"tableTo": "crm_partners",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_contracts_opportunity_id_pc_crm_opportunities_id_fk": {
"name": "crm_contracts_opportunity_id_pc_crm_opportunities_id_fk",
"tableFrom": "crm_contracts",
"tableTo": "pc_crm_opportunities",
"columnsFrom": [
"opportunity_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_events": {
"name": "crm_events",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"opportunity_id": {
"name": "opportunity_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"lead_id": {
"name": "lead_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'meeting'"
},
"start_at": {
"name": "start_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"end_at": {
"name": "end_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"all_day": {
"name": "all_day",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"meeting_link": {
"name": "meeting_link",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_event_id": {
"name": "google_event_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attendees": {
"name": "attendees",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"reminders": {
"name": "reminders",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'scheduled'"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_events_tenant_id_tenants_id_fk": {
"name": "crm_events_tenant_id_tenants_id_fk",
"tableFrom": "crm_events",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_events_user_id_users_id_fk": {
"name": "crm_events_user_id_users_id_fk",
"tableFrom": "crm_events",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_events_opportunity_id_pc_crm_opportunities_id_fk": {
"name": "crm_events_opportunity_id_pc_crm_opportunities_id_fk",
"tableFrom": "crm_events",
"tableTo": "pc_crm_opportunities",
"columnsFrom": [
"opportunity_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_events_lead_id_pc_crm_leads_id_fk": {
"name": "crm_events_lead_id_pc_crm_leads_id_fk",
"tableFrom": "crm_events",
"tableTo": "pc_crm_leads",
"columnsFrom": [
"lead_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_events_client_id_pc_clients_id_fk": {
"name": "crm_events_client_id_pc_clients_id_fk",
"tableFrom": "crm_events",
"tableTo": "pc_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_frappe_connectors": {
"name": "crm_frappe_connectors",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"base_url": {
"name": "base_url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"api_key": {
"name": "api_key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"api_secret": {
"name": "api_secret",
"type": "text",
"primaryKey": false,
"notNull": true
},
"frappe_user": {
"name": "frappe_user",
"type": "text",
"primaryKey": false,
"notNull": false
},
"default_company": {
"name": "default_company",
"type": "text",
"primaryKey": false,
"notNull": false
},
"target_system": {
"name": "target_system",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'erpnext'"
},
"sync_mode": {
"name": "sync_mode",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'manual'"
},
"sync_entities": {
"name": "sync_entities",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"last_sync_at": {
"name": "last_sync_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'inactive'"
},
"error_message": {
"name": "error_message",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_frappe_mappings": {
"name": "crm_frappe_mappings",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"connector_id": {
"name": "connector_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"local_entity": {
"name": "local_entity",
"type": "text",
"primaryKey": false,
"notNull": true
},
"frappe_doctype": {
"name": "frappe_doctype",
"type": "text",
"primaryKey": false,
"notNull": true
},
"field_mappings": {
"name": "field_mappings",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status_mappings": {
"name": "status_mappings",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sync_direction": {
"name": "sync_direction",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'push'"
},
"is_enabled": {
"name": "is_enabled",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
}
},
"indexes": {},
"foreignKeys": {
"crm_frappe_mappings_connector_id_crm_frappe_connectors_id_fk": {
"name": "crm_frappe_mappings_connector_id_crm_frappe_connectors_id_fk",
"tableFrom": "crm_frappe_mappings",
"tableTo": "crm_frappe_connectors",
"columnsFrom": [
"connector_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_google_tokens": {
"name": "crm_google_tokens",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"access_token": {
"name": "access_token",
"type": "text",
"primaryKey": false,
"notNull": true
},
"refresh_token": {
"name": "refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"scope": {
"name": "scope",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_google_tokens_user_id_users_id_fk": {
"name": "crm_google_tokens_user_id_users_id_fk",
"tableFrom": "crm_google_tokens",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"crm_google_tokens_user_id_unique": {
"name": "crm_google_tokens_user_id_unique",
"nullsNotDistinct": false,
"columns": [
"user_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_leads": {
"name": "crm_leads",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "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": "company",
"type": "text",
"primaryKey": false,
"notNull": false
},
"position": {
"name": "position",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'new'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"assigned_to": {
"name": "assigned_to",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"converted_at": {
"name": "converted_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_leads_tenant_id_tenants_id_fk": {
"name": "crm_leads_tenant_id_tenants_id_fk",
"tableFrom": "crm_leads",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_leads_user_id_users_id_fk": {
"name": "crm_leads_user_id_users_id_fk",
"tableFrom": "crm_leads",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_leads_assigned_to_users_id_fk": {
"name": "crm_leads_assigned_to_users_id_fk",
"tableFrom": "crm_leads",
"tableTo": "users",
"columnsFrom": [
"assigned_to"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_messages": {
"name": "crm_messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"thread_id": {
"name": "thread_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"channel_id": {
"name": "channel_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"direction": {
"name": "direction",
"type": "text",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'text'"
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"media_url": {
"name": "media_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"media_type": {
"name": "media_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"external_id": {
"name": "external_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'sent'"
},
"sent_by_id": {
"name": "sent_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"is_from_agent": {
"name": "is_from_agent",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"metadata": {
"name": "metadata",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_messages_thread_id_crm_threads_id_fk": {
"name": "crm_messages_thread_id_crm_threads_id_fk",
"tableFrom": "crm_messages",
"tableTo": "crm_threads",
"columnsFrom": [
"thread_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_messages_channel_id_crm_channels_id_fk": {
"name": "crm_messages_channel_id_crm_channels_id_fk",
"tableFrom": "crm_messages",
"tableTo": "crm_channels",
"columnsFrom": [
"channel_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_messages_sent_by_id_users_id_fk": {
"name": "crm_messages_sent_by_id_users_id_fk",
"tableFrom": "crm_messages",
"tableTo": "users",
"columnsFrom": [
"sent_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_opportunities": {
"name": "crm_opportunities",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"lead_id": {
"name": "lead_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"stage_id": {
"name": "stage_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"value": {
"name": "value",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"currency": {
"name": "currency",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'BRL'"
},
"probability": {
"name": "probability",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 50
},
"expected_close_date": {
"name": "expected_close_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"actual_close_date": {
"name": "actual_close_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'open'"
},
"loss_reason": {
"name": "loss_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"assigned_to": {
"name": "assigned_to",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"approval_status": {
"name": "approval_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"approved_at": {
"name": "approved_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"approved_by": {
"name": "approved_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"process_compass_project_id": {
"name": "process_compass_project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"billing_status": {
"name": "billing_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'none'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_opportunities_tenant_id_tenants_id_fk": {
"name": "crm_opportunities_tenant_id_tenants_id_fk",
"tableFrom": "crm_opportunities",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_opportunities_user_id_users_id_fk": {
"name": "crm_opportunities_user_id_users_id_fk",
"tableFrom": "crm_opportunities",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_opportunities_lead_id_crm_leads_id_fk": {
"name": "crm_opportunities_lead_id_crm_leads_id_fk",
"tableFrom": "crm_opportunities",
"tableTo": "crm_leads",
"columnsFrom": [
"lead_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_opportunities_partner_id_crm_partners_id_fk": {
"name": "crm_opportunities_partner_id_crm_partners_id_fk",
"tableFrom": "crm_opportunities",
"tableTo": "crm_partners",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_opportunities_stage_id_crm_pipeline_stages_id_fk": {
"name": "crm_opportunities_stage_id_crm_pipeline_stages_id_fk",
"tableFrom": "crm_opportunities",
"tableTo": "crm_pipeline_stages",
"columnsFrom": [
"stage_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_opportunities_assigned_to_users_id_fk": {
"name": "crm_opportunities_assigned_to_users_id_fk",
"tableFrom": "crm_opportunities",
"tableTo": "users",
"columnsFrom": [
"assigned_to"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_opportunities_approved_by_users_id_fk": {
"name": "crm_opportunities_approved_by_users_id_fk",
"tableFrom": "crm_opportunities",
"tableTo": "users",
"columnsFrom": [
"approved_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_opportunity_products": {
"name": "crm_opportunity_products",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"opportunity_id": {
"name": "opportunity_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"unit_price": {
"name": "unit_price",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"discount": {
"name": "discount",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"total": {
"name": "total",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
}
},
"indexes": {},
"foreignKeys": {
"crm_opportunity_products_opportunity_id_crm_opportunities_id_fk": {
"name": "crm_opportunity_products_opportunity_id_crm_opportunities_id_fk",
"tableFrom": "crm_opportunity_products",
"tableTo": "crm_opportunities",
"columnsFrom": [
"opportunity_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_opportunity_products_product_id_crm_products_id_fk": {
"name": "crm_opportunity_products_product_id_crm_products_id_fk",
"tableFrom": "crm_opportunity_products",
"tableTo": "crm_products",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_opportunity_registrations": {
"name": "crm_opportunity_registrations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"opportunity_id": {
"name": "opportunity_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"registered_at": {
"name": "registered_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"crm_opportunity_registrations_partner_id_crm_partners_id_fk": {
"name": "crm_opportunity_registrations_partner_id_crm_partners_id_fk",
"tableFrom": "crm_opportunity_registrations",
"tableTo": "crm_partners",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_opportunity_registrations_opportunity_id_pc_crm_opportunities_id_fk": {
"name": "crm_opportunity_registrations_opportunity_id_pc_crm_opportunities_id_fk",
"tableFrom": "crm_opportunity_registrations",
"tableTo": "pc_crm_opportunities",
"columnsFrom": [
"opportunity_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_partner_certifications": {
"name": "crm_partner_certifications",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"certification_name": {
"name": "certification_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"certification_date": {
"name": "certification_date",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"expiration_date": {
"name": "expiration_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"score": {
"name": "score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_partner_certifications_partner_id_crm_partners_id_fk": {
"name": "crm_partner_certifications_partner_id_crm_partners_id_fk",
"tableFrom": "crm_partner_certifications",
"tableTo": "crm_partners",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_partner_certifications_user_id_users_id_fk": {
"name": "crm_partner_certifications_user_id_users_id_fk",
"tableFrom": "crm_partner_certifications",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_partner_performance": {
"name": "crm_partner_performance",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"period": {
"name": "period",
"type": "text",
"primaryKey": false,
"notNull": true
},
"period_type": {
"name": "period_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"arr_generated": {
"name": "arr_generated",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"new_clients": {
"name": "new_clients",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"certified_professionals": {
"name": "certified_professionals",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"nps_average": {
"name": "nps_average",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"cases_published": {
"name": "cases_published",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"portal_usage_rate": {
"name": "portal_usage_rate",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_partner_performance_partner_id_crm_partners_id_fk": {
"name": "crm_partner_performance_partner_id_crm_partners_id_fk",
"tableFrom": "crm_partner_performance",
"tableTo": "crm_partners",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_partners": {
"name": "crm_partners",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"trade_name": {
"name": "trade_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"cnpj": {
"name": "cnpj",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"website": {
"name": "website",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"tier": {
"name": "tier",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'partner'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"contract_start_date": {
"name": "contract_start_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"contract_end_date": {
"name": "contract_end_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"primary_contact_name": {
"name": "primary_contact_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_contact_email": {
"name": "primary_contact_email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_contact_phone": {
"name": "primary_contact_phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "text",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_partners_tenant_id_tenants_id_fk": {
"name": "crm_partners_tenant_id_tenants_id_fk",
"tableFrom": "crm_partners",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_pipeline_stages": {
"name": "crm_pipeline_stages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'#3b82f6'"
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"probability": {
"name": "probability",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 50
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_pipeline_stages_tenant_id_tenants_id_fk": {
"name": "crm_pipeline_stages_tenant_id_tenants_id_fk",
"tableFrom": "crm_pipeline_stages",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_products": {
"name": "crm_products",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'service'"
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": false
},
"price": {
"name": "price",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"currency": {
"name": "currency",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'BRL'"
},
"unit": {
"name": "unit",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'unit'"
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"sku": {
"name": "sku",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_products_tenant_id_tenants_id_fk": {
"name": "crm_products_tenant_id_tenants_id_fk",
"tableFrom": "crm_products",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_proposal_items": {
"name": "crm_proposal_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"proposal_id": {
"name": "proposal_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"item_type": {
"name": "item_type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'product'"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"unit_price": {
"name": "unit_price",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"discount": {
"name": "discount",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"total": {
"name": "total",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
}
},
"indexes": {},
"foreignKeys": {
"crm_proposal_items_proposal_id_crm_proposals_id_fk": {
"name": "crm_proposal_items_proposal_id_crm_proposals_id_fk",
"tableFrom": "crm_proposal_items",
"tableTo": "crm_proposals",
"columnsFrom": [
"proposal_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_proposal_items_product_id_crm_products_id_fk": {
"name": "crm_proposal_items_product_id_crm_products_id_fk",
"tableFrom": "crm_proposal_items",
"tableTo": "crm_products",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_proposals": {
"name": "crm_proposals",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"opportunity_id": {
"name": "opportunity_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"version": {
"name": "version",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"valid_until": {
"name": "valid_until",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"total_value": {
"name": "total_value",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"currency": {
"name": "currency",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'BRL'"
},
"payment_terms": {
"name": "payment_terms",
"type": "text",
"primaryKey": false,
"notNull": false
},
"delivery_terms": {
"name": "delivery_terms",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"internal_notes": {
"name": "internal_notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sent_at": {
"name": "sent_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"viewed_at": {
"name": "viewed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"accepted_at": {
"name": "accepted_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"rejected_at": {
"name": "rejected_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"rejection_reason": {
"name": "rejection_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by_id": {
"name": "created_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_proposals_tenant_id_tenants_id_fk": {
"name": "crm_proposals_tenant_id_tenants_id_fk",
"tableFrom": "crm_proposals",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_proposals_opportunity_id_crm_opportunities_id_fk": {
"name": "crm_proposals_opportunity_id_crm_opportunities_id_fk",
"tableFrom": "crm_proposals",
"tableTo": "crm_opportunities",
"columnsFrom": [
"opportunity_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"crm_proposals_client_id_crm_clients_id_fk": {
"name": "crm_proposals_client_id_crm_clients_id_fk",
"tableFrom": "crm_proposals",
"tableTo": "crm_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"crm_proposals_created_by_id_users_id_fk": {
"name": "crm_proposals_created_by_id_users_id_fk",
"tableFrom": "crm_proposals",
"tableTo": "users",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_quick_messages": {
"name": "crm_quick_messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"shortcut": {
"name": "shortcut",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"media_url": {
"name": "media_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_global": {
"name": "is_global",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_quick_messages_tenant_id_tenants_id_fk": {
"name": "crm_quick_messages_tenant_id_tenants_id_fk",
"tableFrom": "crm_quick_messages",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_quick_messages_user_id_users_id_fk": {
"name": "crm_quick_messages_user_id_users_id_fk",
"tableFrom": "crm_quick_messages",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_revenue_schedule": {
"name": "crm_revenue_schedule",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"contract_id": {
"name": "contract_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"month": {
"name": "month",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"value": {
"name": "value",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"invoice_number": {
"name": "invoice_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"paid_at": {
"name": "paid_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_revenue_schedule_contract_id_crm_contracts_id_fk": {
"name": "crm_revenue_schedule_contract_id_crm_contracts_id_fk",
"tableFrom": "crm_revenue_schedule",
"tableTo": "crm_contracts",
"columnsFrom": [
"contract_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_sync_logs": {
"name": "crm_sync_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"connector_id": {
"name": "connector_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"sync_type": {
"name": "sync_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity": {
"name": "entity",
"type": "text",
"primaryKey": false,
"notNull": false
},
"records_processed": {
"name": "records_processed",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"records_success": {
"name": "records_success",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"records_failed": {
"name": "records_failed",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true
},
"error_details": {
"name": "error_details",
"type": "text",
"primaryKey": false,
"notNull": false
},
"started_at": {
"name": "started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"crm_sync_logs_connector_id_crm_frappe_connectors_id_fk": {
"name": "crm_sync_logs_connector_id_crm_frappe_connectors_id_fk",
"tableFrom": "crm_sync_logs",
"tableTo": "crm_frappe_connectors",
"columnsFrom": [
"connector_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.crm_threads": {
"name": "crm_threads",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"lead_id": {
"name": "lead_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"contact_phone": {
"name": "contact_phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"contact_email": {
"name": "contact_email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"contact_name": {
"name": "contact_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'open'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'normal'"
},
"assigned_to_id": {
"name": "assigned_to_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"queue_id": {
"name": "queue_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"last_message_at": {
"name": "last_message_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"unread_count": {
"name": "unread_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"crm_threads_tenant_id_tenants_id_fk": {
"name": "crm_threads_tenant_id_tenants_id_fk",
"tableFrom": "crm_threads",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"crm_threads_channel_id_crm_channels_id_fk": {
"name": "crm_threads_channel_id_crm_channels_id_fk",
"tableFrom": "crm_threads",
"tableTo": "crm_channels",
"columnsFrom": [
"channel_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_threads_client_id_pc_clients_id_fk": {
"name": "crm_threads_client_id_pc_clients_id_fk",
"tableFrom": "crm_threads",
"tableTo": "pc_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_threads_lead_id_pc_crm_leads_id_fk": {
"name": "crm_threads_lead_id_pc_crm_leads_id_fk",
"tableFrom": "crm_threads",
"tableTo": "pc_crm_leads",
"columnsFrom": [
"lead_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"crm_threads_assigned_to_id_users_id_fk": {
"name": "crm_threads_assigned_to_id_users_id_fk",
"tableFrom": "crm_threads",
"tableTo": "users",
"columnsFrom": [
"assigned_to_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.custom_mcp_servers": {
"name": "custom_mcp_servers",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"transport_type": {
"name": "transport_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'http'"
},
"server_url": {
"name": "server_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"command": {
"name": "command",
"type": "text",
"primaryKey": false,
"notNull": false
},
"args": {
"name": "args",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"icon_url": {
"name": "icon_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"custom_headers": {
"name": "custom_headers",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"custom_mcp_servers_user_id_users_id_fk": {
"name": "custom_mcp_servers_user_id_users_id_fk",
"tableFrom": "custom_mcp_servers",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.customers": {
"name": "customers",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'company'"
},
"tax_id": {
"name": "tax_id",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"country": {
"name": "country",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false,
"default": "'Brasil'"
},
"credit_limit": {
"name": "credit_limit",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"payment_terms": {
"name": "payment_terms",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 30
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"customers_tenant_id_tenants_id_fk": {
"name": "customers_tenant_id_tenants_id_fk",
"tableFrom": "customers",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.dashboard_widgets": {
"name": "dashboard_widgets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"config": {
"name": "config",
"type": "text",
"primaryKey": false,
"notNull": false
},
"position": {
"name": "position",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_visible": {
"name": "is_visible",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"dashboard_widgets_user_id_users_id_fk": {
"name": "dashboard_widgets_user_id_users_id_fk",
"tableFrom": "dashboard_widgets",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.data_sources": {
"name": "data_sources",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"host": {
"name": "host",
"type": "text",
"primaryKey": false,
"notNull": false
},
"port": {
"name": "port",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"database": {
"name": "database",
"type": "text",
"primaryKey": false,
"notNull": false
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": false
},
"password": {
"name": "password",
"type": "text",
"primaryKey": false,
"notNull": false
},
"connection_string": {
"name": "connection_string",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"last_tested_at": {
"name": "last_tested_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"data_sources_user_id_users_id_fk": {
"name": "data_sources_user_id_users_id_fk",
"tableFrom": "data_sources",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.device_evaluations": {
"name": "device_evaluations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"brand": {
"name": "brand",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"model": {
"name": "model",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"color": {
"name": "color",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"customer_id": {
"name": "customer_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"customer_name": {
"name": "customer_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"customer_phone": {
"name": "customer_phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"evaluation_date": {
"name": "evaluation_date",
"type": "date",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_DATE"
},
"screen_condition": {
"name": "screen_condition",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"screen_notes": {
"name": "screen_notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"body_condition": {
"name": "body_condition",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"body_notes": {
"name": "body_notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"charger_included": {
"name": "charger_included",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"charger_condition": {
"name": "charger_condition",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"battery_health": {
"name": "battery_health",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"battery_notes": {
"name": "battery_notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"camera_front_working": {
"name": "camera_front_working",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"camera_rear_working": {
"name": "camera_rear_working",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"audio_working": {
"name": "audio_working",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"buttons_working": {
"name": "buttons_working",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"connectivity_working": {
"name": "connectivity_working",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"water_damage_detected": {
"name": "water_damage_detected",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"overall_condition": {
"name": "overall_condition",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"estimated_value": {
"name": "estimated_value",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"approved": {
"name": "approved",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"rejection_reason": {
"name": "rejection_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"evaluated_by": {
"name": "evaluated_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"approved_by": {
"name": "approved_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"device_evaluations_tenant_id_tenants_id_fk": {
"name": "device_evaluations_tenant_id_tenants_id_fk",
"tableFrom": "device_evaluations",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"device_evaluations_store_id_retail_stores_id_fk": {
"name": "device_evaluations_store_id_retail_stores_id_fk",
"tableFrom": "device_evaluations",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"device_evaluations_device_id_mobile_devices_id_fk": {
"name": "device_evaluations_device_id_mobile_devices_id_fk",
"tableFrom": "device_evaluations",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.device_history": {
"name": "device_history",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"event_type": {
"name": "event_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"event_date": {
"name": "event_date",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"from_location": {
"name": "from_location",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"to_location": {
"name": "to_location",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"reference_type": {
"name": "reference_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"reference_id": {
"name": "reference_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"device_history_device_id_mobile_devices_id_fk": {
"name": "device_history_device_id_mobile_devices_id_fk",
"tableFrom": "device_history",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.doctype_fields": {
"name": "doctype_fields",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"doctype_id": {
"name": "doctype_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"fieldname": {
"name": "fieldname",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"label": {
"name": "label",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"fieldtype": {
"name": "fieldtype",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"options": {
"name": "options",
"type": "text",
"primaryKey": false,
"notNull": false
},
"default_value": {
"name": "default_value",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reqd": {
"name": "reqd",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"unique": {
"name": "unique",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"in_list_view": {
"name": "in_list_view",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"in_standard_filter": {
"name": "in_standard_filter",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"hidden": {
"name": "hidden",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"read_only": {
"name": "read_only",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"idx": {
"name": "idx",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"doctype_fields_doctype_id_doctypes_id_fk": {
"name": "doctype_fields_doctype_id_doctypes_id_fk",
"tableFrom": "doctype_fields",
"tableTo": "doctypes",
"columnsFrom": [
"doctype_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.doctype_records": {
"name": "doctype_records",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"doctype_name": {
"name": "doctype_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"owner_id": {
"name": "owner_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"data": {
"name": "data",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"docstatus": {
"name": "docstatus",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"doctype_records_tenant_id_tenants_id_fk": {
"name": "doctype_records_tenant_id_tenants_id_fk",
"tableFrom": "doctype_records",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"doctype_records_owner_id_users_id_fk": {
"name": "doctype_records_owner_id_users_id_fk",
"tableFrom": "doctype_records",
"tableTo": "users",
"columnsFrom": [
"owner_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.doctypes": {
"name": "doctypes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"module": {
"name": "module",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false,
"default": "'Core'"
},
"label": {
"name": "label",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_single": {
"name": "is_single",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_submittable": {
"name": "is_submittable",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_child": {
"name": "is_child",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"parent_doctype": {
"name": "parent_doctype",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"icon": {
"name": "icon",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"track_changes": {
"name": "track_changes",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"permissions": {
"name": "permissions",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"doctypes_name_unique": {
"name": "doctypes_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.email_accounts": {
"name": "email_accounts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"password": {
"name": "password",
"type": "text",
"primaryKey": false,
"notNull": false
},
"display_name": {
"name": "display_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"provider": {
"name": "provider",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'gmail'"
},
"imap_host": {
"name": "imap_host",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"imap_port": {
"name": "imap_port",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 993
},
"smtp_host": {
"name": "smtp_host",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"smtp_port": {
"name": "smtp_port",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 587
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'disconnected'"
},
"last_sync_at": {
"name": "last_sync_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"email_accounts_user_id_users_id_fk": {
"name": "email_accounts_user_id_users_id_fk",
"tableFrom": "email_accounts",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"email_accounts_tenant_id_tenants_id_fk": {
"name": "email_accounts_tenant_id_tenants_id_fk",
"tableFrom": "email_accounts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.email_attachments": {
"name": "email_attachments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"message_id": {
"name": "message_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"filename": {
"name": "filename",
"type": "varchar(512)",
"primaryKey": false,
"notNull": true
},
"mime_type": {
"name": "mime_type",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"size": {
"name": "size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"content_id": {
"name": "content_id",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"storage_path": {
"name": "storage_path",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"email_attachments_message_id_email_messages_id_fk": {
"name": "email_attachments_message_id_email_messages_id_fk",
"tableFrom": "email_attachments",
"tableTo": "email_messages",
"columnsFrom": [
"message_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.email_folders": {
"name": "email_folders",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"account_id": {
"name": "account_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'custom'"
},
"unread_count": {
"name": "unread_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"total_count": {
"name": "total_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"email_folders_account_id_email_accounts_id_fk": {
"name": "email_folders_account_id_email_accounts_id_fk",
"tableFrom": "email_folders",
"tableTo": "email_accounts",
"columnsFrom": [
"account_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.email_messages": {
"name": "email_messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"account_id": {
"name": "account_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"folder_id": {
"name": "folder_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"message_id": {
"name": "message_id",
"type": "varchar(512)",
"primaryKey": false,
"notNull": false
},
"thread_id": {
"name": "thread_id",
"type": "varchar(512)",
"primaryKey": false,
"notNull": false
},
"from_address": {
"name": "from_address",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"from_name": {
"name": "from_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"to_addresses": {
"name": "to_addresses",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"cc_addresses": {
"name": "cc_addresses",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"bcc_addresses": {
"name": "bcc_addresses",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"subject": {
"name": "subject",
"type": "text",
"primaryKey": false,
"notNull": false
},
"body_text": {
"name": "body_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"body_html": {
"name": "body_html",
"type": "text",
"primaryKey": false,
"notNull": false
},
"snippet": {
"name": "snippet",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_read": {
"name": "is_read",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_starred": {
"name": "is_starred",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"has_attachments": {
"name": "has_attachments",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"labels": {
"name": "labels",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"reply_to_id": {
"name": "reply_to_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"received_at": {
"name": "received_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"sent_at": {
"name": "sent_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"email_messages_account_id_email_accounts_id_fk": {
"name": "email_messages_account_id_email_accounts_id_fk",
"tableFrom": "email_messages",
"tableTo": "email_accounts",
"columnsFrom": [
"account_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"email_messages_folder_id_email_folders_id_fk": {
"name": "email_messages_folder_id_email_folders_id_fk",
"tableFrom": "email_messages",
"tableTo": "email_folders",
"columnsFrom": [
"folder_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.environmental_services": {
"name": "environmental_services",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"base_price": {
"name": "base_price",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"unit": {
"name": "unit",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'projeto'"
},
"estimated_duration": {
"name": "estimated_duration",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"items": {
"name": "items",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"environmental_services_tenant_id_tenants_id_fk": {
"name": "environmental_services_tenant_id_tenants_id_fk",
"tableFrom": "environmental_services",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.erp_config": {
"name": "erp_config",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"segment_id": {
"name": "segment_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"company_name": {
"name": "company_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"trade_name": {
"name": "trade_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"tax_id": {
"name": "tax_id",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"state_registration": {
"name": "state_registration",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"city_registration": {
"name": "city_registration",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"tax_regime": {
"name": "tax_regime",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"zip_code": {
"name": "zip_code",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"website": {
"name": "website",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"logo_url": {
"name": "logo_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"erpnext_url": {
"name": "erpnext_url",
"type": "varchar(512)",
"primaryKey": false,
"notNull": false
},
"erpnext_enabled": {
"name": "erpnext_enabled",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"modules_crm": {
"name": "modules_crm",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"modules_sales": {
"name": "modules_sales",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"modules_purchases": {
"name": "modules_purchases",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"modules_stock": {
"name": "modules_stock",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"modules_finance": {
"name": "modules_finance",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"modules_accounting": {
"name": "modules_accounting",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"modules_production": {
"name": "modules_production",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"modules_projects": {
"name": "modules_projects",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"modules_hr": {
"name": "modules_hr",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"modules_service_order": {
"name": "modules_service_order",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"default_currency": {
"name": "default_currency",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false,
"default": "'BRL'"
},
"decimal_places": {
"name": "decimal_places",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 2
},
"fiscal_document_series": {
"name": "fiscal_document_series",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false,
"default": "'1'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"erp_config_tenant_id_tenants_id_fk": {
"name": "erp_config_tenant_id_tenants_id_fk",
"tableFrom": "erp_config",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"erp_config_segment_id_erp_segments_id_fk": {
"name": "erp_config_segment_id_erp_segments_id_fk",
"tableFrom": "erp_config",
"tableTo": "erp_segments",
"columnsFrom": [
"segment_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"erp_config_tenant_id_unique": {
"name": "erp_config_tenant_id_unique",
"nullsNotDistinct": false,
"columns": [
"tenant_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.erp_connections": {
"name": "erp_connections",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"base_url": {
"name": "base_url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"api_key": {
"name": "api_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"api_secret": {
"name": "api_secret",
"type": "text",
"primaryKey": false,
"notNull": false
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": false
},
"password": {
"name": "password",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.erp_segments": {
"name": "erp_segments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"modules": {
"name": "modules",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"features": {
"name": "features",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"erp_segments_code_unique": {
"name": "erp_segments_code_unique",
"nullsNotDistinct": false,
"columns": [
"code"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.external_app_permissions": {
"name": "external_app_permissions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"app_name": {
"name": "app_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"app_url": {
"name": "app_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"can_access": {
"name": "can_access",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"api_key_id": {
"name": "api_key_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"external_app_permissions_user_id_users_id_fk": {
"name": "external_app_permissions_user_id_users_id_fk",
"tableFrom": "external_app_permissions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.field_expenses": {
"name": "field_expenses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"expense_code": {
"name": "expense_code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"responsible_id": {
"name": "responsible_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"expense_date": {
"name": "expense_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"amount": {
"name": "amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"payment_method": {
"name": "payment_method",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"card_id": {
"name": "card_id",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"receipt_url": {
"name": "receipt_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"cost_center": {
"name": "cost_center",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'pendente'"
},
"approved_by_leader": {
"name": "approved_by_leader",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"approved_by_leader_at": {
"name": "approved_by_leader_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"approved_by_finance": {
"name": "approved_by_finance",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"approved_by_finance_at": {
"name": "approved_by_finance_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"rejection_reason": {
"name": "rejection_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"observations": {
"name": "observations",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"field_expenses_tenant_id_tenants_id_fk": {
"name": "field_expenses_tenant_id_tenants_id_fk",
"tableFrom": "field_expenses",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"field_expenses_project_id_pc_projects_id_fk": {
"name": "field_expenses_project_id_pc_projects_id_fk",
"tableFrom": "field_expenses",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"field_expenses_responsible_id_users_id_fk": {
"name": "field_expenses_responsible_id_users_id_fk",
"tableFrom": "field_expenses",
"tableTo": "users",
"columnsFrom": [
"responsible_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"field_expenses_approved_by_leader_users_id_fk": {
"name": "field_expenses_approved_by_leader_users_id_fk",
"tableFrom": "field_expenses",
"tableTo": "users",
"columnsFrom": [
"approved_by_leader"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"field_expenses_approved_by_finance_users_id_fk": {
"name": "field_expenses_approved_by_finance_users_id_fk",
"tableFrom": "field_expenses",
"tableTo": "users",
"columnsFrom": [
"approved_by_finance"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fin_accounts_payable": {
"name": "fin_accounts_payable",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"document_number": {
"name": "document_number",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"supplier_id": {
"name": "supplier_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"supplier_name": {
"name": "supplier_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"category_id": {
"name": "category_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"issue_date": {
"name": "issue_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"due_date": {
"name": "due_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"original_amount": {
"name": "original_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"discount_amount": {
"name": "discount_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"interest_amount": {
"name": "interest_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"fine_amount": {
"name": "fine_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"paid_amount": {
"name": "paid_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"remaining_amount": {
"name": "remaining_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"payment_method_id": {
"name": "payment_method_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"bank_account_id": {
"name": "bank_account_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"paid_at": {
"name": "paid_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"purchase_order_id": {
"name": "purchase_order_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fin_accounts_payable_tenant_id_tenants_id_fk": {
"name": "fin_accounts_payable_tenant_id_tenants_id_fk",
"tableFrom": "fin_accounts_payable",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_payable_supplier_id_suppliers_id_fk": {
"name": "fin_accounts_payable_supplier_id_suppliers_id_fk",
"tableFrom": "fin_accounts_payable",
"tableTo": "suppliers",
"columnsFrom": [
"supplier_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_payable_category_id_fin_cash_flow_categories_id_fk": {
"name": "fin_accounts_payable_category_id_fin_cash_flow_categories_id_fk",
"tableFrom": "fin_accounts_payable",
"tableTo": "fin_cash_flow_categories",
"columnsFrom": [
"category_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_payable_payment_method_id_fin_payment_methods_id_fk": {
"name": "fin_accounts_payable_payment_method_id_fin_payment_methods_id_fk",
"tableFrom": "fin_accounts_payable",
"tableTo": "fin_payment_methods",
"columnsFrom": [
"payment_method_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_payable_bank_account_id_fin_bank_accounts_id_fk": {
"name": "fin_accounts_payable_bank_account_id_fin_bank_accounts_id_fk",
"tableFrom": "fin_accounts_payable",
"tableTo": "fin_bank_accounts",
"columnsFrom": [
"bank_account_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_payable_purchase_order_id_purchase_orders_id_fk": {
"name": "fin_accounts_payable_purchase_order_id_purchase_orders_id_fk",
"tableFrom": "fin_accounts_payable",
"tableTo": "purchase_orders",
"columnsFrom": [
"purchase_order_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fin_accounts_receivable": {
"name": "fin_accounts_receivable",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"document_number": {
"name": "document_number",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"customer_id": {
"name": "customer_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"customer_name": {
"name": "customer_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"category_id": {
"name": "category_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"issue_date": {
"name": "issue_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"due_date": {
"name": "due_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"original_amount": {
"name": "original_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"discount_amount": {
"name": "discount_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"interest_amount": {
"name": "interest_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"fine_amount": {
"name": "fine_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"received_amount": {
"name": "received_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"remaining_amount": {
"name": "remaining_amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"payment_method_id": {
"name": "payment_method_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"bank_account_id": {
"name": "bank_account_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"received_at": {
"name": "received_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"sales_order_id": {
"name": "sales_order_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fin_accounts_receivable_tenant_id_tenants_id_fk": {
"name": "fin_accounts_receivable_tenant_id_tenants_id_fk",
"tableFrom": "fin_accounts_receivable",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_receivable_customer_id_customers_id_fk": {
"name": "fin_accounts_receivable_customer_id_customers_id_fk",
"tableFrom": "fin_accounts_receivable",
"tableTo": "customers",
"columnsFrom": [
"customer_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_receivable_category_id_fin_cash_flow_categories_id_fk": {
"name": "fin_accounts_receivable_category_id_fin_cash_flow_categories_id_fk",
"tableFrom": "fin_accounts_receivable",
"tableTo": "fin_cash_flow_categories",
"columnsFrom": [
"category_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_receivable_payment_method_id_fin_payment_methods_id_fk": {
"name": "fin_accounts_receivable_payment_method_id_fin_payment_methods_id_fk",
"tableFrom": "fin_accounts_receivable",
"tableTo": "fin_payment_methods",
"columnsFrom": [
"payment_method_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_receivable_bank_account_id_fin_bank_accounts_id_fk": {
"name": "fin_accounts_receivable_bank_account_id_fin_bank_accounts_id_fk",
"tableFrom": "fin_accounts_receivable",
"tableTo": "fin_bank_accounts",
"columnsFrom": [
"bank_account_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_accounts_receivable_sales_order_id_sales_orders_id_fk": {
"name": "fin_accounts_receivable_sales_order_id_sales_orders_id_fk",
"tableFrom": "fin_accounts_receivable",
"tableTo": "sales_orders",
"columnsFrom": [
"sales_order_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fin_bank_accounts": {
"name": "fin_bank_accounts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"bank_code": {
"name": "bank_code",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"bank_name": {
"name": "bank_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"agency": {
"name": "agency",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"account_number": {
"name": "account_number",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"account_digit": {
"name": "account_digit",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"account_type": {
"name": "account_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'checking'"
},
"initial_balance": {
"name": "initial_balance",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"current_balance": {
"name": "current_balance",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fin_bank_accounts_tenant_id_tenants_id_fk": {
"name": "fin_bank_accounts_tenant_id_tenants_id_fk",
"tableFrom": "fin_bank_accounts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fin_cash_flow_categories": {
"name": "fin_cash_flow_categories",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"parent_id": {
"name": "parent_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"contabil_account_id": {
"name": "contabil_account_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fin_cash_flow_categories_tenant_id_tenants_id_fk": {
"name": "fin_cash_flow_categories_tenant_id_tenants_id_fk",
"tableFrom": "fin_cash_flow_categories",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fin_payment_methods": {
"name": "fin_payment_methods",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"default_bank_account_id": {
"name": "default_bank_account_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"fee": {
"name": "fee",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"days_to_receive": {
"name": "days_to_receive",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fin_payment_methods_tenant_id_tenants_id_fk": {
"name": "fin_payment_methods_tenant_id_tenants_id_fk",
"tableFrom": "fin_payment_methods",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_payment_methods_default_bank_account_id_fin_bank_accounts_id_fk": {
"name": "fin_payment_methods_default_bank_account_id_fin_bank_accounts_id_fk",
"tableFrom": "fin_payment_methods",
"tableTo": "fin_bank_accounts",
"columnsFrom": [
"default_bank_account_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fin_payment_plans": {
"name": "fin_payment_plans",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"installments": {
"name": "installments",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"interval_days": {
"name": "interval_days",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 30
},
"first_due_days": {
"name": "first_due_days",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 30
},
"discount_percent": {
"name": "discount_percent",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"interest_percent": {
"name": "interest_percent",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fin_payment_plans_tenant_id_tenants_id_fk": {
"name": "fin_payment_plans_tenant_id_tenants_id_fk",
"tableFrom": "fin_payment_plans",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fin_transactions": {
"name": "fin_transactions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"bank_account_id": {
"name": "bank_account_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"category_id": {
"name": "category_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"amount": {
"name": "amount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"balance_after": {
"name": "balance_after",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"transaction_date": {
"name": "transaction_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"document_number": {
"name": "document_number",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"payable_id": {
"name": "payable_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"receivable_id": {
"name": "receivable_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"transfer_from_id": {
"name": "transfer_from_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"transfer_to_id": {
"name": "transfer_to_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"reconciled": {
"name": "reconciled",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"reconciled_at": {
"name": "reconciled_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fin_transactions_tenant_id_tenants_id_fk": {
"name": "fin_transactions_tenant_id_tenants_id_fk",
"tableFrom": "fin_transactions",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_transactions_bank_account_id_fin_bank_accounts_id_fk": {
"name": "fin_transactions_bank_account_id_fin_bank_accounts_id_fk",
"tableFrom": "fin_transactions",
"tableTo": "fin_bank_accounts",
"columnsFrom": [
"bank_account_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_transactions_category_id_fin_cash_flow_categories_id_fk": {
"name": "fin_transactions_category_id_fin_cash_flow_categories_id_fk",
"tableFrom": "fin_transactions",
"tableTo": "fin_cash_flow_categories",
"columnsFrom": [
"category_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_transactions_payable_id_fin_accounts_payable_id_fk": {
"name": "fin_transactions_payable_id_fin_accounts_payable_id_fk",
"tableFrom": "fin_transactions",
"tableTo": "fin_accounts_payable",
"columnsFrom": [
"payable_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fin_transactions_receivable_id_fin_accounts_receivable_id_fk": {
"name": "fin_transactions_receivable_id_fin_accounts_receivable_id_fk",
"tableFrom": "fin_transactions",
"tableTo": "fin_accounts_receivable",
"columnsFrom": [
"receivable_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_certificados": {
"name": "fiscal_certificados",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"nome": {
"name": "nome",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(5)",
"primaryKey": false,
"notNull": true
},
"cnpj": {
"name": "cnpj",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"razao_social": {
"name": "razao_social",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"serial_number": {
"name": "serial_number",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"valido_ate": {
"name": "valido_ate",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"arquivo": {
"name": "arquivo",
"type": "text",
"primaryKey": false,
"notNull": false
},
"senha": {
"name": "senha",
"type": "text",
"primaryKey": false,
"notNull": false
},
"ambiente": {
"name": "ambiente",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'homologacao'"
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fiscal_certificados_tenant_id_tenants_id_fk": {
"name": "fiscal_certificados_tenant_id_tenants_id_fk",
"tableFrom": "fiscal_certificados",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_cests": {
"name": "fiscal_cests",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"codigo": {
"name": "codigo",
"type": "varchar(9)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "text",
"primaryKey": false,
"notNull": true
},
"ncm_inicio": {
"name": "ncm_inicio",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"ncm_fim": {
"name": "ncm_fim",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"segmento": {
"name": "segmento",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"fiscal_cests_codigo_unique": {
"name": "fiscal_cests_codigo_unique",
"nullsNotDistinct": false,
"columns": [
"codigo"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_cfops": {
"name": "fiscal_cfops",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"codigo": {
"name": "codigo",
"type": "varchar(4)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "text",
"primaryKey": false,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"natureza": {
"name": "natureza",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"gera_credito": {
"name": "gera_credito",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"gera_debito": {
"name": "gera_debito",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"movimenta_estoque": {
"name": "movimenta_estoque",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"aplicacao": {
"name": "aplicacao",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"fiscal_cfops_codigo_unique": {
"name": "fiscal_cfops_codigo_unique",
"nullsNotDistinct": false,
"columns": [
"codigo"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_configuracoes": {
"name": "fiscal_configuracoes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"cnpj": {
"name": "cnpj",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"ie": {
"name": "ie",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"im": {
"name": "im",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"cnae": {
"name": "cnae",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"crt": {
"name": "crt",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"serie_nfe": {
"name": "serie_nfe",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"serie_nfce": {
"name": "serie_nfce",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"proximo_num_nfe": {
"name": "proximo_num_nfe",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"proximo_num_nfce": {
"name": "proximo_num_nfce",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"csc_id": {
"name": "csc_id",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"csc_token": {
"name": "csc_token",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"ambiente": {
"name": "ambiente",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'homologacao'"
},
"certificado_id": {
"name": "certificado_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"horario_inicio": {
"name": "horario_inicio",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"horario_fim": {
"name": "horario_fim",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"enviar_email_automatico": {
"name": "enviar_email_automatico",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"imprimir_danfe_automatico": {
"name": "imprimir_danfe_automatico",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fiscal_configuracoes_tenant_id_tenants_id_fk": {
"name": "fiscal_configuracoes_tenant_id_tenants_id_fk",
"tableFrom": "fiscal_configuracoes",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fiscal_configuracoes_certificado_id_fiscal_certificados_id_fk": {
"name": "fiscal_configuracoes_certificado_id_fiscal_certificados_id_fk",
"tableFrom": "fiscal_configuracoes",
"tableTo": "fiscal_certificados",
"columnsFrom": [
"certificado_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"fiscal_configuracoes_tenant_id_unique": {
"name": "fiscal_configuracoes_tenant_id_unique",
"nullsNotDistinct": false,
"columns": [
"tenant_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_eventos": {
"name": "fiscal_eventos",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"nota_id": {
"name": "nota_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"tipo_evento": {
"name": "tipo_evento",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
},
"sequencia": {
"name": "sequencia",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"descricao": {
"name": "descricao",
"type": "text",
"primaryKey": false,
"notNull": false
},
"justificativa": {
"name": "justificativa",
"type": "text",
"primaryKey": false,
"notNull": false
},
"protocolo": {
"name": "protocolo",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"data_evento": {
"name": "data_evento",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"xml_evento": {
"name": "xml_evento",
"type": "text",
"primaryKey": false,
"notNull": false
},
"xml_retorno": {
"name": "xml_retorno",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fiscal_eventos_nota_id_fiscal_notas_id_fk": {
"name": "fiscal_eventos_nota_id_fiscal_notas_id_fk",
"tableFrom": "fiscal_eventos",
"tableTo": "fiscal_notas",
"columnsFrom": [
"nota_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"fiscal_eventos_created_by_users_id_fk": {
"name": "fiscal_eventos_created_by_users_id_fk",
"tableFrom": "fiscal_eventos",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_grupos_tributacao": {
"name": "fiscal_grupos_tributacao",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"nome": {
"name": "nome",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "text",
"primaryKey": false,
"notNull": false
},
"ncm": {
"name": "ncm",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"cest": {
"name": "cest",
"type": "varchar(9)",
"primaryKey": false,
"notNull": false
},
"cst_csosn": {
"name": "cst_csosn",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"perc_icms": {
"name": "perc_icms",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_red_bc": {
"name": "perc_red_bc",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"mod_bc_st": {
"name": "mod_bc_st",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"perc_mva_st": {
"name": "perc_mva_st",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_icms_st": {
"name": "perc_icms_st",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_red_bc_st": {
"name": "perc_red_bc_st",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cst_pis": {
"name": "cst_pis",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"perc_pis": {
"name": "perc_pis",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cst_cofins": {
"name": "cst_cofins",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"perc_cofins": {
"name": "perc_cofins",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cst_ipi": {
"name": "cst_ipi",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"perc_ipi": {
"name": "perc_ipi",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"c_enq": {
"name": "c_enq",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"cfop_estadual": {
"name": "cfop_estadual",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"cfop_outro_estado": {
"name": "cfop_outro_estado",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"cfop_entrada_estadual": {
"name": "cfop_entrada_estadual",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"cfop_entrada_outro_estado": {
"name": "cfop_entrada_outro_estado",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"codigo_beneficio_fiscal": {
"name": "codigo_beneficio_fiscal",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"cst_ibs_cbs": {
"name": "cst_ibs_cbs",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"classe_trib_ibs_cbs": {
"name": "classe_trib_ibs_cbs",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"perc_ibs_uf": {
"name": "perc_ibs_uf",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_ibs_mun": {
"name": "perc_ibs_mun",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_cbs": {
"name": "perc_cbs",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_dif": {
"name": "perc_dif",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"padrao": {
"name": "padrao",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fiscal_grupos_tributacao_tenant_id_tenants_id_fk": {
"name": "fiscal_grupos_tributacao_tenant_id_tenants_id_fk",
"tableFrom": "fiscal_grupos_tributacao",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_ibpt": {
"name": "fiscal_ibpt",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"ncm": {
"name": "ncm",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
},
"ex_tipi": {
"name": "ex_tipi",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"tabela": {
"name": "tabela",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"aliq_nac": {
"name": "aliq_nac",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"aliq_imp": {
"name": "aliq_imp",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"aliq_est": {
"name": "aliq_est",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"aliq_mun": {
"name": "aliq_mun",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"vigencia_inicio": {
"name": "vigencia_inicio",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"vigencia_fim": {
"name": "vigencia_fim",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"versao": {
"name": "versao",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_natureza_operacao": {
"name": "fiscal_natureza_operacao",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"descricao": {
"name": "descricao",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"cst_csosn": {
"name": "cst_csosn",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"cst_pis": {
"name": "cst_pis",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"cst_cofins": {
"name": "cst_cofins",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"cst_ipi": {
"name": "cst_ipi",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"cfop_estadual": {
"name": "cfop_estadual",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"cfop_outro_estado": {
"name": "cfop_outro_estado",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"cfop_entrada_estadual": {
"name": "cfop_entrada_estadual",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"cfop_entrada_outro_estado": {
"name": "cfop_entrada_outro_estado",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"perc_icms": {
"name": "perc_icms",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_pis": {
"name": "perc_pis",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_cofins": {
"name": "perc_cofins",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_ipi": {
"name": "perc_ipi",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"sobrescrever_cfop": {
"name": "sobrescrever_cfop",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"movimentar_estoque": {
"name": "movimentar_estoque",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"padrao": {
"name": "padrao",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fiscal_natureza_operacao_tenant_id_tenants_id_fk": {
"name": "fiscal_natureza_operacao_tenant_id_tenants_id_fk",
"tableFrom": "fiscal_natureza_operacao",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_ncms": {
"name": "fiscal_ncms",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"codigo": {
"name": "codigo",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "text",
"primaryKey": false,
"notNull": true
},
"aliq_ipi": {
"name": "aliq_ipi",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"aliq_import": {
"name": "aliq_import",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"unidade_tributavel": {
"name": "unidade_tributavel",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"ex_tipi": {
"name": "ex_tipi",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"fiscal_ncms_codigo_unique": {
"name": "fiscal_ncms_codigo_unique",
"nullsNotDistinct": false,
"columns": [
"codigo"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_nota_itens": {
"name": "fiscal_nota_itens",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"nota_id": {
"name": "nota_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"produto_id": {
"name": "produto_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(60)",
"primaryKey": false,
"notNull": false
},
"descricao": {
"name": "descricao",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"ncm": {
"name": "ncm",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"cest": {
"name": "cest",
"type": "varchar(9)",
"primaryKey": false,
"notNull": false
},
"cfop": {
"name": "cfop",
"type": "varchar(4)",
"primaryKey": false,
"notNull": false
},
"unidade": {
"name": "unidade",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"quantidade": {
"name": "quantidade",
"type": "numeric(15, 4)",
"primaryKey": false,
"notNull": true
},
"valor_unitario": {
"name": "valor_unitario",
"type": "numeric(15, 4)",
"primaryKey": false,
"notNull": true
},
"valor_desconto": {
"name": "valor_desconto",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_total": {
"name": "valor_total",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"origem": {
"name": "origem",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"cst_csosn": {
"name": "cst_csosn",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"bc_icms": {
"name": "bc_icms",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_icms": {
"name": "perc_icms",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_icms": {
"name": "valor_icms",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"bc_icms_st": {
"name": "bc_icms_st",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_icms_st": {
"name": "perc_icms_st",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_icms_st": {
"name": "valor_icms_st",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cst_pis": {
"name": "cst_pis",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"bc_pis": {
"name": "bc_pis",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_pis": {
"name": "perc_pis",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_pis": {
"name": "valor_pis",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cst_cofins": {
"name": "cst_cofins",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"bc_cofins": {
"name": "bc_cofins",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_cofins": {
"name": "perc_cofins",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_cofins": {
"name": "valor_cofins",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cst_ipi": {
"name": "cst_ipi",
"type": "varchar(3)",
"primaryKey": false,
"notNull": false
},
"bc_ipi": {
"name": "bc_ipi",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"perc_ipi": {
"name": "perc_ipi",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_ipi": {
"name": "valor_ipi",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cst_ibs_cbs": {
"name": "cst_ibs_cbs",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"valor_ibs_uf": {
"name": "valor_ibs_uf",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_ibs_mun": {
"name": "valor_ibs_mun",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_cbs": {
"name": "valor_cbs",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"ordem": {
"name": "ordem",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
}
},
"indexes": {},
"foreignKeys": {
"fiscal_nota_itens_nota_id_fiscal_notas_id_fk": {
"name": "fiscal_nota_itens_nota_id_fiscal_notas_id_fk",
"tableFrom": "fiscal_nota_itens",
"tableTo": "fiscal_notas",
"columnsFrom": [
"nota_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.fiscal_notas": {
"name": "fiscal_notas",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"modelo": {
"name": "modelo",
"type": "varchar(3)",
"primaryKey": false,
"notNull": true
},
"serie": {
"name": "serie",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"numero": {
"name": "numero",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"chave": {
"name": "chave",
"type": "varchar(44)",
"primaryKey": false,
"notNull": false
},
"natureza_operacao": {
"name": "natureza_operacao",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"data_emissao": {
"name": "data_emissao",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"data_saida": {
"name": "data_saida",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"tipo_operacao": {
"name": "tipo_operacao",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"tipo_emissao": {
"name": "tipo_emissao",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false,
"default": "'1'"
},
"finalidade": {
"name": "finalidade",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false,
"default": "'1'"
},
"consumidor_final": {
"name": "consumidor_final",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"presenca_comprador": {
"name": "presenca_comprador",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false,
"default": "'1'"
},
"destinatario_id": {
"name": "destinatario_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"destinatario_tipo": {
"name": "destinatario_tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"destinatario_doc": {
"name": "destinatario_doc",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"destinatario_nome": {
"name": "destinatario_nome",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"valor_produtos": {
"name": "valor_produtos",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_frete": {
"name": "valor_frete",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_seguro": {
"name": "valor_seguro",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_desconto": {
"name": "valor_desconto",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_outros": {
"name": "valor_outros",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_total": {
"name": "valor_total",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_icms": {
"name": "valor_icms",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_icms_st": {
"name": "valor_icms_st",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_pis": {
"name": "valor_pis",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_cofins": {
"name": "valor_cofins",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_ipi": {
"name": "valor_ipi",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_ibs_uf": {
"name": "valor_ibs_uf",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_ibs_mun": {
"name": "valor_ibs_mun",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_cbs": {
"name": "valor_cbs",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"status": {
"name": "status",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false,
"default": "'rascunho'"
},
"codigo_status": {
"name": "codigo_status",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"motivo_status": {
"name": "motivo_status",
"type": "text",
"primaryKey": false,
"notNull": false
},
"protocolo": {
"name": "protocolo",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"data_autorizacao": {
"name": "data_autorizacao",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"xml_envio": {
"name": "xml_envio",
"type": "text",
"primaryKey": false,
"notNull": false
},
"xml_retorno": {
"name": "xml_retorno",
"type": "text",
"primaryKey": false,
"notNull": false
},
"xml_autorizado": {
"name": "xml_autorizado",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pedido_origem_id": {
"name": "pedido_origem_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"pedido_origem_tipo": {
"name": "pedido_origem_tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"informacoes_adicionais": {
"name": "informacoes_adicionais",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"fiscal_notas_tenant_id_tenants_id_fk": {
"name": "fiscal_notas_tenant_id_tenants_id_fk",
"tableFrom": "fiscal_notas",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"fiscal_notas_created_by_users_id_fk": {
"name": "fiscal_notas_created_by_users_id_fk",
"tableFrom": "fiscal_notas",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.generated_code": {
"name": "generated_code",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"language": {
"name": "language",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true,
"default": "'python'"
},
"code_type": {
"name": "code_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"parameters": {
"name": "parameters",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"generated_from": {
"name": "generated_from",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"usage_count": {
"name": "usage_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"last_used_at": {
"name": "last_used_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"generated_code_tenant_id_tenants_id_fk": {
"name": "generated_code_tenant_id_tenants_id_fk",
"tableFrom": "generated_code",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.graph_edges": {
"name": "graph_edges",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"source_id": {
"name": "source_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"target_id": {
"name": "target_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"relation": {
"name": "relation",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"weight": {
"name": "weight",
"type": "numeric",
"primaryKey": false,
"notNull": false,
"default": "'1.0'"
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"graph_edges_source_id_graph_nodes_id_fk": {
"name": "graph_edges_source_id_graph_nodes_id_fk",
"tableFrom": "graph_edges",
"tableTo": "graph_nodes",
"columnsFrom": [
"source_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"graph_edges_target_id_graph_nodes_id_fk": {
"name": "graph_edges_target_id_graph_nodes_id_fk",
"tableFrom": "graph_edges",
"tableTo": "graph_nodes",
"columnsFrom": [
"target_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.graph_nodes": {
"name": "graph_nodes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"external_id": {
"name": "external_id",
"type": "varchar(512)",
"primaryKey": false,
"notNull": false
},
"data": {
"name": "data",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"embedding": {
"name": "embedding",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"graph_nodes_tenant_id_tenants_id_fk": {
"name": "graph_nodes_tenant_id_tenants_id_fk",
"tableFrom": "graph_nodes",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.imei_history": {
"name": "imei_history",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"action": {
"name": "action",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"previous_status": {
"name": "previous_status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"new_status": {
"name": "new_status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"previous_location": {
"name": "previous_location",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"new_location": {
"name": "new_location",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"related_order_id": {
"name": "related_order_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"related_order_type": {
"name": "related_order_type",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"related_order_number": {
"name": "related_order_number",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"cost": {
"name": "cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_by_name": {
"name": "created_by_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"imei_history_tenant_id_tenants_id_fk": {
"name": "imei_history_tenant_id_tenants_id_fk",
"tableFrom": "imei_history",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"imei_history_device_id_mobile_devices_id_fk": {
"name": "imei_history_device_id_mobile_devices_id_fk",
"tableFrom": "imei_history",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.knowledge_base": {
"name": "knowledge_base",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"author": {
"name": "author",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.learned_interactions": {
"name": "learned_interactions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"session_id": {
"name": "session_id",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"question": {
"name": "question",
"type": "text",
"primaryKey": false,
"notNull": true
},
"answer": {
"name": "answer",
"type": "text",
"primaryKey": false,
"notNull": true
},
"context": {
"name": "context",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"tools_used": {
"name": "tools_used",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"data_sources_accessed": {
"name": "data_sources_accessed",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"confidence": {
"name": "confidence",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"feedback": {
"name": "feedback",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"is_indexed": {
"name": "is_indexed",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"learned_interactions_tenant_id_tenants_id_fk": {
"name": "learned_interactions_tenant_id_tenants_id_fk",
"tableFrom": "learned_interactions",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"learned_interactions_user_id_users_id_fk": {
"name": "learned_interactions_user_id_users_id_fk",
"tableFrom": "learned_interactions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.learned_patterns": {
"name": "learned_patterns",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pattern_type": {
"name": "pattern_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"source_dataset": {
"name": "source_dataset",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"source_table": {
"name": "source_table",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"pattern": {
"name": "pattern",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"confidence": {
"name": "confidence",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"usage_count": {
"name": "usage_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"last_used_at": {
"name": "last_used_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"learned_patterns_tenant_id_tenants_id_fk": {
"name": "learned_patterns_tenant_id_tenants_id_fk",
"tableFrom": "learned_patterns",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.learning_events": {
"name": "learning_events",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"session_id": {
"name": "session_id",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"event_type": {
"name": "event_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"module": {
"name": "module",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"data": {
"name": "data",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"time_spent": {
"name": "time_spent",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_processed": {
"name": "is_processed",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"processed_at": {
"name": "processed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"learning_events_tenant_id_tenants_id_fk": {
"name": "learning_events_tenant_id_tenants_id_fk",
"tableFrom": "learning_events",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"learning_events_user_id_users_id_fk": {
"name": "learning_events_user_id_users_id_fk",
"tableFrom": "learning_events",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.lease_agreements": {
"name": "lease_agreements",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"agreement_number": {
"name": "agreement_number",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"customer_id": {
"name": "customer_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"customer_name": {
"name": "customer_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"customer_cpf": {
"name": "customer_cpf",
"type": "varchar(14)",
"primaryKey": false,
"notNull": false
},
"customer_phone": {
"name": "customer_phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"lease_start_date": {
"name": "lease_start_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"lease_end_date": {
"name": "lease_end_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"number_of_months": {
"name": "number_of_months",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"monthly_payment": {
"name": "monthly_payment",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"total_lease_cost": {
"name": "total_lease_cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"purchase_option_available": {
"name": "purchase_option_available",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"purchase_price": {
"name": "purchase_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"purchase_price_includes_paid_rent": {
"name": "purchase_price_includes_paid_rent",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"rent_credit_percent": {
"name": "rent_credit_percent",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'50'"
},
"paid_months": {
"name": "paid_months",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"total_paid": {
"name": "total_paid",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"lease_agreements_tenant_id_tenants_id_fk": {
"name": "lease_agreements_tenant_id_tenants_id_fk",
"tableFrom": "lease_agreements",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"lease_agreements_store_id_retail_stores_id_fk": {
"name": "lease_agreements_store_id_retail_stores_id_fk",
"tableFrom": "lease_agreements",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"lease_agreements_device_id_mobile_devices_id_fk": {
"name": "lease_agreements_device_id_mobile_devices_id_fk",
"tableFrom": "lease_agreements",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.lease_payments": {
"name": "lease_payments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"lease_id": {
"name": "lease_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"payment_number": {
"name": "payment_number",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"due_date": {
"name": "due_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"amount": {
"name": "amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"paid_amount": {
"name": "paid_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"paid_date": {
"name": "paid_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"payment_method": {
"name": "payment_method",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"lease_payments_lease_id_lease_agreements_id_fk": {
"name": "lease_payments_lease_id_lease_agreements_id_fk",
"tableFrom": "lease_payments",
"tableTo": "lease_agreements",
"columnsFrom": [
"lease_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.manus_runs": {
"name": "manus_runs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"prompt": {
"name": "prompt",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'running'"
},
"result": {
"name": "result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"manus_runs_user_id_users_id_fk": {
"name": "manus_runs_user_id_users_id_fk",
"tableFrom": "manus_runs",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.manus_steps": {
"name": "manus_steps",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"run_id": {
"name": "run_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"step_number": {
"name": "step_number",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"thought": {
"name": "thought",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tool": {
"name": "tool",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tool_input": {
"name": "tool_input",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tool_output": {
"name": "tool_output",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"manus_steps_run_id_manus_runs_id_fk": {
"name": "manus_steps_run_id_manus_runs_id_fk",
"tableFrom": "manus_steps",
"tableTo": "manus_runs",
"columnsFrom": [
"run_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.messages": {
"name": "messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"conversation_id": {
"name": "conversation_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"interaction_id": {
"name": "interaction_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"messages_conversation_id_conversations_id_fk": {
"name": "messages_conversation_id_conversations_id_fk",
"tableFrom": "messages",
"tableTo": "conversations",
"columnsFrom": [
"conversation_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.migration_jobs": {
"name": "migration_jobs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"staged_table_id": {
"name": "staged_table_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"mapping_id": {
"name": "mapping_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"erp_connection_id": {
"name": "erp_connection_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"total_records": {
"name": "total_records",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"processed_records": {
"name": "processed_records",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"success_records": {
"name": "success_records",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"error_records": {
"name": "error_records",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"error_log": {
"name": "error_log",
"type": "text",
"primaryKey": false,
"notNull": false
},
"started_at": {
"name": "started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"migration_jobs_user_id_users_id_fk": {
"name": "migration_jobs_user_id_users_id_fk",
"tableFrom": "migration_jobs",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"migration_jobs_staged_table_id_staged_tables_id_fk": {
"name": "migration_jobs_staged_table_id_staged_tables_id_fk",
"tableFrom": "migration_jobs",
"tableTo": "staged_tables",
"columnsFrom": [
"staged_table_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"migration_jobs_mapping_id_staging_mappings_id_fk": {
"name": "migration_jobs_mapping_id_staging_mappings_id_fk",
"tableFrom": "migration_jobs",
"tableTo": "staging_mappings",
"columnsFrom": [
"mapping_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"migration_jobs_erp_connection_id_erp_connections_id_fk": {
"name": "migration_jobs_erp_connection_id_erp_connections_id_fk",
"tableFrom": "migration_jobs",
"tableTo": "erp_connections",
"columnsFrom": [
"erp_connection_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.mobile_devices": {
"name": "mobile_devices",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"imei2": {
"name": "imei2",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"brand": {
"name": "brand",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"model": {
"name": "model",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"color": {
"name": "color",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"storage": {
"name": "storage",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"ram": {
"name": "ram",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"condition": {
"name": "condition",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'new'"
},
"purchase_date": {
"name": "purchase_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"purchase_price": {
"name": "purchase_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"selling_price": {
"name": "selling_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"warranty_expiry": {
"name": "warranty_expiry",
"type": "date",
"primaryKey": false,
"notNull": false
},
"warehouse_id": {
"name": "warehouse_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'in_stock'"
},
"sold_date": {
"name": "sold_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"sold_to_customer": {
"name": "sold_to_customer",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"last_service_date": {
"name": "last_service_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"acquisition_type": {
"name": "acquisition_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'purchase'"
},
"acquisition_cost": {
"name": "acquisition_cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"related_evaluation_id": {
"name": "related_evaluation_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"related_service_order_id": {
"name": "related_service_order_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"person_id": {
"name": "person_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"suggested_price": {
"name": "suggested_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"profit_margin": {
"name": "profit_margin",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"erpnext_item_code": {
"name": "erpnext_item_code",
"type": "varchar(140)",
"primaryKey": false,
"notNull": false
},
"erpnext_serial_no": {
"name": "erpnext_serial_no",
"type": "varchar(140)",
"primaryKey": false,
"notNull": false
},
"last_sync_at": {
"name": "last_sync_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"mobile_devices_tenant_id_tenants_id_fk": {
"name": "mobile_devices_tenant_id_tenants_id_fk",
"tableFrom": "mobile_devices",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"mobile_devices_warehouse_id_retail_warehouses_id_fk": {
"name": "mobile_devices_warehouse_id_retail_warehouses_id_fk",
"tableFrom": "mobile_devices",
"tableTo": "retail_warehouses",
"columnsFrom": [
"warehouse_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"mobile_devices_store_id_retail_stores_id_fk": {
"name": "mobile_devices_store_id_retail_stores_id_fk",
"tableFrom": "mobile_devices",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.module_access": {
"name": "module_access",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"module": {
"name": "module",
"type": "text",
"primaryKey": false,
"notNull": true
},
"can_access": {
"name": "can_access",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"module_access_user_id_users_id_fk": {
"name": "module_access_user_id_users_id_fk",
"tableFrom": "module_access",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.page_blocks": {
"name": "page_blocks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"page_id": {
"name": "page_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"parent_block_id": {
"name": "parent_block_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"properties": {
"name": "properties",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"page_blocks_page_id_workspace_pages_id_fk": {
"name": "page_blocks_page_id_workspace_pages_id_fk",
"tableFrom": "page_blocks",
"tableTo": "workspace_pages",
"columnsFrom": [
"page_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.page_links": {
"name": "page_links",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"source_page_id": {
"name": "source_page_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"target_page_id": {
"name": "target_page_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"block_id": {
"name": "block_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"page_links_source_page_id_workspace_pages_id_fk": {
"name": "page_links_source_page_id_workspace_pages_id_fk",
"tableFrom": "page_links",
"tableTo": "workspace_pages",
"columnsFrom": [
"source_page_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"page_links_target_page_id_workspace_pages_id_fk": {
"name": "page_links_target_page_id_workspace_pages_id_fk",
"tableFrom": "page_links",
"tableTo": "workspace_pages",
"columnsFrom": [
"target_page_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"page_links_block_id_page_blocks_id_fk": {
"name": "page_links_block_id_page_blocks_id_fk",
"tableFrom": "page_links",
"tableTo": "page_blocks",
"columnsFrom": [
"block_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.para_archive": {
"name": "para_archive",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"original_type": {
"name": "original_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"original_id": {
"name": "original_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"archived_at": {
"name": "archived_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"para_archive_user_id_users_id_fk": {
"name": "para_archive_user_id_users_id_fk",
"tableFrom": "para_archive",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.para_areas": {
"name": "para_areas",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"icon": {
"name": "icon",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'#10b981'"
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"para_areas_user_id_users_id_fk": {
"name": "para_areas_user_id_users_id_fk",
"tableFrom": "para_areas",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.para_projects": {
"name": "para_projects",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"project_type": {
"name": "project_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'personal'"
},
"production_project_id": {
"name": "production_project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"color": {
"name": "color",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'#3b82f6'"
},
"icon": {
"name": "icon",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"progress": {
"name": "progress",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"para_projects_user_id_users_id_fk": {
"name": "para_projects_user_id_users_id_fk",
"tableFrom": "para_projects",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.para_resources": {
"name": "para_resources",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'link'"
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"area_id": {
"name": "area_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"para_resources_user_id_users_id_fk": {
"name": "para_resources_user_id_users_id_fk",
"tableFrom": "para_resources",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"para_resources_project_id_para_projects_id_fk": {
"name": "para_resources_project_id_para_projects_id_fk",
"tableFrom": "para_resources",
"tableTo": "para_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"para_resources_area_id_para_areas_id_fk": {
"name": "para_resources_area_id_para_areas_id_fk",
"tableFrom": "para_resources",
"tableTo": "para_areas",
"columnsFrom": [
"area_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.para_tasks": {
"name": "para_tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(300)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"area_id": {
"name": "area_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"triad_category": {
"name": "triad_category",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true,
"default": "'importante'"
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"priority": {
"name": "priority",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"reminder_at": {
"name": "reminder_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"estimated_minutes": {
"name": "estimated_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"para_tasks_user_id_users_id_fk": {
"name": "para_tasks_user_id_users_id_fk",
"tableFrom": "para_tasks",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"para_tasks_project_id_para_projects_id_fk": {
"name": "para_tasks_project_id_para_projects_id_fk",
"tableFrom": "para_tasks",
"tableTo": "para_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"para_tasks_area_id_para_areas_id_fk": {
"name": "para_tasks_area_id_para_areas_id_fk",
"tableFrom": "para_tasks",
"tableTo": "para_areas",
"columnsFrom": [
"area_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.partner_clients": {
"name": "partner_clients",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"commission_rate": {
"name": "commission_rate",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"started_at": {
"name": "started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"ended_at": {
"name": "ended_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"partner_clients_partner_id_tenants_id_fk": {
"name": "partner_clients_partner_id_tenants_id_fk",
"tableFrom": "partner_clients",
"tableTo": "tenants",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"partner_clients_client_id_tenants_id_fk": {
"name": "partner_clients_client_id_tenants_id_fk",
"tableFrom": "partner_clients",
"tableTo": "tenants",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.partner_commissions": {
"name": "partner_commissions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"reference_month": {
"name": "reference_month",
"type": "text",
"primaryKey": false,
"notNull": true
},
"client_plan_code": {
"name": "client_plan_code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"client_plan_value": {
"name": "client_plan_value",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"commission_rate": {
"name": "commission_rate",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true
},
"commission_value": {
"name": "commission_value",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"approved_at": {
"name": "approved_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"paid_at": {
"name": "paid_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"payment_reference": {
"name": "payment_reference",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"partner_commissions_partner_id_tenants_id_fk": {
"name": "partner_commissions_partner_id_tenants_id_fk",
"tableFrom": "partner_commissions",
"tableTo": "tenants",
"columnsFrom": [
"partner_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"partner_commissions_client_id_tenants_id_fk": {
"name": "partner_commissions_client_id_tenants_id_fk",
"tableFrom": "partner_commissions",
"tableTo": "tenants",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.payment_plan_installments": {
"name": "payment_plan_installments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"plan_id": {
"name": "plan_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"installment_number": {
"name": "installment_number",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"due_date": {
"name": "due_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"amount": {
"name": "amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"paid_amount": {
"name": "paid_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"paid_date": {
"name": "paid_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"payment_method": {
"name": "payment_method",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"payment_plan_installments_plan_id_payment_plans_id_fk": {
"name": "payment_plan_installments_plan_id_payment_plans_id_fk",
"tableFrom": "payment_plan_installments",
"tableTo": "payment_plans",
"columnsFrom": [
"plan_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.payment_plans": {
"name": "payment_plans",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"sale_id": {
"name": "sale_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"customer_id": {
"name": "customer_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"customer_name": {
"name": "customer_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"total_amount": {
"name": "total_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"down_payment": {
"name": "down_payment",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"remaining_amount": {
"name": "remaining_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"number_of_installments": {
"name": "number_of_installments",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"installment_amount": {
"name": "installment_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"interest_rate": {
"name": "interest_rate",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"first_installment_date": {
"name": "first_installment_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"paid_installments": {
"name": "paid_installments",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"total_paid": {
"name": "total_paid",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"payment_plans_tenant_id_tenants_id_fk": {
"name": "payment_plans_tenant_id_tenants_id_fk",
"tableFrom": "payment_plans",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"payment_plans_sale_id_pos_sales_id_fk": {
"name": "payment_plans_sale_id_pos_sales_id_fk",
"tableFrom": "payment_plans",
"tableTo": "pos_sales",
"columnsFrom": [
"sale_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_canvas_blocks": {
"name": "pc_canvas_blocks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"block_type": {
"name": "block_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"level": {
"name": "level",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'intencao'"
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"synthesis": {
"name": "synthesis",
"type": "text",
"primaryKey": false,
"notNull": false
},
"score": {
"name": "score",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"pdca_status": {
"name": "pdca_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'plan'"
},
"pdca_action_plan": {
"name": "pdca_action_plan",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pdca_result": {
"name": "pdca_result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_canvas_blocks_project_id_pc_projects_id_fk": {
"name": "pc_canvas_blocks_project_id_pc_projects_id_fk",
"tableFrom": "pc_canvas_blocks",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_canvas_expected_outputs": {
"name": "pc_canvas_expected_outputs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"block_id": {
"name": "block_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"label": {
"name": "label",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_canvas_expected_outputs_block_id_pc_canvas_blocks_id_fk": {
"name": "pc_canvas_expected_outputs_block_id_pc_canvas_blocks_id_fk",
"tableFrom": "pc_canvas_expected_outputs",
"tableTo": "pc_canvas_blocks",
"columnsFrom": [
"block_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_canvas_pdca_links": {
"name": "pc_canvas_pdca_links",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"block_id": {
"name": "block_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"pdca_status": {
"name": "pdca_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'plan'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_canvas_pdca_links_block_id_pc_canvas_blocks_id_fk": {
"name": "pc_canvas_pdca_links_block_id_pc_canvas_blocks_id_fk",
"tableFrom": "pc_canvas_pdca_links",
"tableTo": "pc_canvas_blocks",
"columnsFrom": [
"block_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_canvas_questions": {
"name": "pc_canvas_questions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"block_id": {
"name": "block_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"question": {
"name": "question",
"type": "text",
"primaryKey": false,
"notNull": true
},
"answer": {
"name": "answer",
"type": "text",
"primaryKey": false,
"notNull": false
},
"score": {
"name": "score",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_canvas_questions_block_id_pc_canvas_blocks_id_fk": {
"name": "pc_canvas_questions_block_id_pc_canvas_blocks_id_fk",
"tableFrom": "pc_canvas_questions",
"tableTo": "pc_canvas_blocks",
"columnsFrom": [
"block_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_canvas_swot_links": {
"name": "pc_canvas_swot_links",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"block_id": {
"name": "block_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"swot_item_id": {
"name": "swot_item_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_canvas_swot_links_block_id_pc_canvas_blocks_id_fk": {
"name": "pc_canvas_swot_links_block_id_pc_canvas_blocks_id_fk",
"tableFrom": "pc_canvas_swot_links",
"tableTo": "pc_canvas_blocks",
"columnsFrom": [
"block_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_canvas_swot_links_swot_item_id_pc_swot_items_id_fk": {
"name": "pc_canvas_swot_links_swot_item_id_pc_swot_items_id_fk",
"tableFrom": "pc_canvas_swot_links",
"tableTo": "pc_swot_items",
"columnsFrom": [
"swot_item_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_client_contacts": {
"name": "pc_client_contacts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_primary": {
"name": "is_primary",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_client_contacts_client_id_pc_clients_id_fk": {
"name": "pc_client_contacts_client_id_pc_clients_id_fk",
"tableFrom": "pc_client_contacts",
"tableTo": "pc_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_clients": {
"name": "pc_clients",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "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": "company",
"type": "text",
"primaryKey": false,
"notNull": false
},
"industry": {
"name": "industry",
"type": "text",
"primaryKey": false,
"notNull": false
},
"website": {
"name": "website",
"type": "text",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"logo_url": {
"name": "logo_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_clients_tenant_id_tenants_id_fk": {
"name": "pc_clients_tenant_id_tenants_id_fk",
"tableFrom": "pc_clients",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_clients_user_id_users_id_fk": {
"name": "pc_clients_user_id_users_id_fk",
"tableFrom": "pc_clients",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_collaborators": {
"name": "pc_collaborators",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "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
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'programador'"
},
"hourly_rate": {
"name": "hourly_rate",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"skills": {
"name": "skills",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_collaborators_tenant_id_tenants_id_fk": {
"name": "pc_collaborators_tenant_id_tenants_id_fk",
"tableFrom": "pc_collaborators",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_crm_activities": {
"name": "pc_crm_activities",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"opportunity_id": {
"name": "opportunity_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"lead_id": {
"name": "lead_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"is_completed": {
"name": "is_completed",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"assigned_to_id": {
"name": "assigned_to_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_crm_activities_tenant_id_tenants_id_fk": {
"name": "pc_crm_activities_tenant_id_tenants_id_fk",
"tableFrom": "pc_crm_activities",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_activities_user_id_users_id_fk": {
"name": "pc_crm_activities_user_id_users_id_fk",
"tableFrom": "pc_crm_activities",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_activities_opportunity_id_pc_crm_opportunities_id_fk": {
"name": "pc_crm_activities_opportunity_id_pc_crm_opportunities_id_fk",
"tableFrom": "pc_crm_activities",
"tableTo": "pc_crm_opportunities",
"columnsFrom": [
"opportunity_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_activities_lead_id_pc_crm_leads_id_fk": {
"name": "pc_crm_activities_lead_id_pc_crm_leads_id_fk",
"tableFrom": "pc_crm_activities",
"tableTo": "pc_crm_leads",
"columnsFrom": [
"lead_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_activities_client_id_pc_clients_id_fk": {
"name": "pc_crm_activities_client_id_pc_clients_id_fk",
"tableFrom": "pc_crm_activities",
"tableTo": "pc_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_crm_activities_assigned_to_id_users_id_fk": {
"name": "pc_crm_activities_assigned_to_id_users_id_fk",
"tableFrom": "pc_crm_activities",
"tableTo": "users",
"columnsFrom": [
"assigned_to_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_crm_leads": {
"name": "pc_crm_leads",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "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": "company",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'new'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"assigned_to_id": {
"name": "assigned_to_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"converted_to_client_id": {
"name": "converted_to_client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"converted_at": {
"name": "converted_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_crm_leads_tenant_id_tenants_id_fk": {
"name": "pc_crm_leads_tenant_id_tenants_id_fk",
"tableFrom": "pc_crm_leads",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_leads_user_id_users_id_fk": {
"name": "pc_crm_leads_user_id_users_id_fk",
"tableFrom": "pc_crm_leads",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_leads_assigned_to_id_users_id_fk": {
"name": "pc_crm_leads_assigned_to_id_users_id_fk",
"tableFrom": "pc_crm_leads",
"tableTo": "users",
"columnsFrom": [
"assigned_to_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_crm_leads_converted_to_client_id_pc_clients_id_fk": {
"name": "pc_crm_leads_converted_to_client_id_pc_clients_id_fk",
"tableFrom": "pc_crm_leads",
"tableTo": "pc_clients",
"columnsFrom": [
"converted_to_client_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_crm_opportunities": {
"name": "pc_crm_opportunities",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"lead_id": {
"name": "lead_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"stage_id": {
"name": "stage_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"value": {
"name": "value",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"probability": {
"name": "probability",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 50
},
"expected_close_date": {
"name": "expected_close_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"actual_close_date": {
"name": "actual_close_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'open'"
},
"lost_reason": {
"name": "lost_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"assigned_to_id": {
"name": "assigned_to_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_crm_opportunities_tenant_id_tenants_id_fk": {
"name": "pc_crm_opportunities_tenant_id_tenants_id_fk",
"tableFrom": "pc_crm_opportunities",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_opportunities_user_id_users_id_fk": {
"name": "pc_crm_opportunities_user_id_users_id_fk",
"tableFrom": "pc_crm_opportunities",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_opportunities_client_id_pc_clients_id_fk": {
"name": "pc_crm_opportunities_client_id_pc_clients_id_fk",
"tableFrom": "pc_crm_opportunities",
"tableTo": "pc_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_crm_opportunities_lead_id_pc_crm_leads_id_fk": {
"name": "pc_crm_opportunities_lead_id_pc_crm_leads_id_fk",
"tableFrom": "pc_crm_opportunities",
"tableTo": "pc_crm_leads",
"columnsFrom": [
"lead_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_crm_opportunities_stage_id_pc_crm_stages_id_fk": {
"name": "pc_crm_opportunities_stage_id_pc_crm_stages_id_fk",
"tableFrom": "pc_crm_opportunities",
"tableTo": "pc_crm_stages",
"columnsFrom": [
"stage_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_crm_opportunities_assigned_to_id_users_id_fk": {
"name": "pc_crm_opportunities_assigned_to_id_users_id_fk",
"tableFrom": "pc_crm_opportunities",
"tableTo": "users",
"columnsFrom": [
"assigned_to_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_crm_stages": {
"name": "pc_crm_stages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'#3b82f6'"
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_default": {
"name": "is_default",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_crm_stages_tenant_id_tenants_id_fk": {
"name": "pc_crm_stages_tenant_id_tenants_id_fk",
"tableFrom": "pc_crm_stages",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_crm_stages_user_id_users_id_fk": {
"name": "pc_crm_stages_user_id_users_id_fk",
"tableFrom": "pc_crm_stages",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_deliverables": {
"name": "pc_deliverables",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"file_url": {
"name": "file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"assigned_to_id": {
"name": "assigned_to_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"pc_deliverables_project_id_pc_projects_id_fk": {
"name": "pc_deliverables_project_id_pc_projects_id_fk",
"tableFrom": "pc_deliverables",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_deliverables_assigned_to_id_users_id_fk": {
"name": "pc_deliverables_assigned_to_id_users_id_fk",
"tableFrom": "pc_deliverables",
"tableTo": "users",
"columnsFrom": [
"assigned_to_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_erp_modules": {
"name": "pc_erp_modules",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_erp_modules_tenant_id_tenants_id_fk": {
"name": "pc_erp_modules_tenant_id_tenants_id_fk",
"tableFrom": "pc_erp_modules",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_erp_parameterization_items": {
"name": "pc_erp_parameterization_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"topic_id": {
"name": "topic_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_completed": {
"name": "is_completed",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_by_id": {
"name": "completed_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_erp_parameterization_items_topic_id_pc_erp_parameterization_topics_id_fk": {
"name": "pc_erp_parameterization_items_topic_id_pc_erp_parameterization_topics_id_fk",
"tableFrom": "pc_erp_parameterization_items",
"tableTo": "pc_erp_parameterization_topics",
"columnsFrom": [
"topic_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_erp_parameterization_items_completed_by_id_users_id_fk": {
"name": "pc_erp_parameterization_items_completed_by_id_users_id_fk",
"tableFrom": "pc_erp_parameterization_items",
"tableTo": "users",
"columnsFrom": [
"completed_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_erp_parameterization_topics": {
"name": "pc_erp_parameterization_topics",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"erp_module": {
"name": "erp_module",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_erp_parameterization_topics_tenant_id_tenants_id_fk": {
"name": "pc_erp_parameterization_topics_tenant_id_tenants_id_fk",
"tableFrom": "pc_erp_parameterization_topics",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_erp_parameterization_topics_project_id_pc_projects_id_fk": {
"name": "pc_erp_parameterization_topics_project_id_pc_projects_id_fk",
"tableFrom": "pc_erp_parameterization_topics",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_erp_requirements": {
"name": "pc_erp_requirements",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"process_id": {
"name": "process_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"erp_module_id": {
"name": "erp_module_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"requirement": {
"name": "requirement",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"erp_module": {
"name": "erp_module",
"type": "text",
"primaryKey": false,
"notNull": false
},
"adherence_status": {
"name": "adherence_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'nao_atendido'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'media'"
},
"customization_notes": {
"name": "customization_notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"estimated_effort": {
"name": "estimated_effort",
"type": "text",
"primaryKey": false,
"notNull": false
},
"process_redesign_required": {
"name": "process_redesign_required",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"pdca_status": {
"name": "pdca_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'plan'"
},
"recommendation": {
"name": "recommendation",
"type": "text",
"primaryKey": false,
"notNull": false
},
"action_due_date": {
"name": "action_due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"action_assignee_id": {
"name": "action_assignee_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"action_result": {
"name": "action_result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_erp_requirements_tenant_id_tenants_id_fk": {
"name": "pc_erp_requirements_tenant_id_tenants_id_fk",
"tableFrom": "pc_erp_requirements",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_erp_requirements_project_id_pc_projects_id_fk": {
"name": "pc_erp_requirements_project_id_pc_projects_id_fk",
"tableFrom": "pc_erp_requirements",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_erp_requirements_process_id_pc_processes_id_fk": {
"name": "pc_erp_requirements_process_id_pc_processes_id_fk",
"tableFrom": "pc_erp_requirements",
"tableTo": "pc_processes",
"columnsFrom": [
"process_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_erp_requirements_erp_module_id_pc_erp_modules_id_fk": {
"name": "pc_erp_requirements_erp_module_id_pc_erp_modules_id_fk",
"tableFrom": "pc_erp_requirements",
"tableTo": "pc_erp_modules",
"columnsFrom": [
"erp_module_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_erp_requirements_action_assignee_id_users_id_fk": {
"name": "pc_erp_requirements_action_assignee_id_users_id_fk",
"tableFrom": "pc_erp_requirements",
"tableTo": "users",
"columnsFrom": [
"action_assignee_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_generated_reports": {
"name": "pc_generated_reports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"configuration_id": {
"name": "configuration_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"report_type": {
"name": "report_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"format": {
"name": "format",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'pdf'"
},
"file_path": {
"name": "file_path",
"type": "text",
"primaryKey": false,
"notNull": false
},
"file_size": {
"name": "file_size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"generated_by": {
"name": "generated_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"generated_at": {
"name": "generated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'{}'::jsonb"
}
},
"indexes": {},
"foreignKeys": {
"pc_generated_reports_tenant_id_tenants_id_fk": {
"name": "pc_generated_reports_tenant_id_tenants_id_fk",
"tableFrom": "pc_generated_reports",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_generated_reports_configuration_id_pc_report_configurations_id_fk": {
"name": "pc_generated_reports_configuration_id_pc_report_configurations_id_fk",
"tableFrom": "pc_generated_reports",
"tableTo": "pc_report_configurations",
"columnsFrom": [
"configuration_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_generated_reports_project_id_pc_projects_id_fk": {
"name": "pc_generated_reports_project_id_pc_projects_id_fk",
"tableFrom": "pc_generated_reports",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_generated_reports_generated_by_users_id_fk": {
"name": "pc_generated_reports_generated_by_users_id_fk",
"tableFrom": "pc_generated_reports",
"tableTo": "users",
"columnsFrom": [
"generated_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_pdca_actions": {
"name": "pc_pdca_actions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"cycle_id": {
"name": "cycle_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"phase": {
"name": "phase",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"responsible": {
"name": "responsible",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_pdca_actions_cycle_id_pc_pdca_cycles_id_fk": {
"name": "pc_pdca_actions_cycle_id_pc_pdca_cycles_id_fk",
"tableFrom": "pc_pdca_actions",
"tableTo": "pc_pdca_cycles",
"columnsFrom": [
"cycle_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_pdca_cycles": {
"name": "pc_pdca_cycles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'plan'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'medium'"
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"pc_pdca_cycles_tenant_id_tenants_id_fk": {
"name": "pc_pdca_cycles_tenant_id_tenants_id_fk",
"tableFrom": "pc_pdca_cycles",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_pdca_cycles_project_id_pc_projects_id_fk": {
"name": "pc_pdca_cycles_project_id_pc_projects_id_fk",
"tableFrom": "pc_pdca_cycles",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_process_steps": {
"name": "pc_process_steps",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"process_id": {
"name": "process_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"responsible": {
"name": "responsible",
"type": "text",
"primaryKey": false,
"notNull": false
},
"inputs": {
"name": "inputs",
"type": "text",
"primaryKey": false,
"notNull": false
},
"outputs": {
"name": "outputs",
"type": "text",
"primaryKey": false,
"notNull": false
},
"systems": {
"name": "systems",
"type": "text",
"primaryKey": false,
"notNull": false
},
"duration": {
"name": "duration",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pain_points": {
"name": "pain_points",
"type": "text",
"primaryKey": false,
"notNull": false
},
"improvements": {
"name": "improvements",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"pdca_status": {
"name": "pdca_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'plan'"
},
"pdca_action_plan": {
"name": "pdca_action_plan",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pdca_result": {
"name": "pdca_result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_process_steps_process_id_pc_processes_id_fk": {
"name": "pc_process_steps_process_id_pc_processes_id_fk",
"tableFrom": "pc_process_steps",
"tableTo": "pc_processes",
"columnsFrom": [
"process_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_processes": {
"name": "pc_processes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": false
},
"owner": {
"name": "owner",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"priority": {
"name": "priority",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"diagram_nodes": {
"name": "diagram_nodes",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"diagram_edges": {
"name": "diagram_edges",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"diagram_viewport": {
"name": "diagram_viewport",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_processes_project_id_pc_projects_id_fk": {
"name": "pc_processes_project_id_pc_projects_id_fk",
"tableFrom": "pc_processes",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_project_activities": {
"name": "pc_project_activities",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"activity_type": {
"name": "activity_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_project_activities_project_id_pc_projects_id_fk": {
"name": "pc_project_activities_project_id_pc_projects_id_fk",
"tableFrom": "pc_project_activities",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_project_activities_user_id_users_id_fk": {
"name": "pc_project_activities_user_id_users_id_fk",
"tableFrom": "pc_project_activities",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_project_files": {
"name": "pc_project_files",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"original_name": {
"name": "original_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"mime_type": {
"name": "mime_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"size": {
"name": "size",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_project_files_project_id_pc_projects_id_fk": {
"name": "pc_project_files_project_id_pc_projects_id_fk",
"tableFrom": "pc_project_files",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_project_history": {
"name": "pc_project_history",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_project_history_project_id_pc_projects_id_fk": {
"name": "pc_project_history_project_id_pc_projects_id_fk",
"tableFrom": "pc_project_history",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"pc_project_history_project_id_unique": {
"name": "pc_project_history_project_id_unique",
"nullsNotDistinct": false,
"columns": [
"project_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_project_members": {
"name": "pc_project_members",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"collaborator_id": {
"name": "collaborator_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'member'"
},
"is_external": {
"name": "is_external",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"assigned_at": {
"name": "assigned_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_project_members_project_id_pc_projects_id_fk": {
"name": "pc_project_members_project_id_pc_projects_id_fk",
"tableFrom": "pc_project_members",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_project_members_user_id_users_id_fk": {
"name": "pc_project_members_user_id_users_id_fk",
"tableFrom": "pc_project_members",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_project_tasks": {
"name": "pc_project_tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'medium'"
},
"assigned_to": {
"name": "assigned_to",
"type": "text",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_project_tasks_project_id_pc_projects_id_fk": {
"name": "pc_project_tasks_project_id_pc_projects_id_fk",
"tableFrom": "pc_project_tasks",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_project_team_members": {
"name": "pc_project_team_members",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_project_team_members_project_id_pc_projects_id_fk": {
"name": "pc_project_team_members_project_id_pc_projects_id_fk",
"tableFrom": "pc_project_team_members",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_projects": {
"name": "pc_projects",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"project_type": {
"name": "project_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'consultoria'"
},
"prod_type": {
"name": "prod_type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'internal'"
},
"client_name": {
"name": "client_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"compass_project_id": {
"name": "compass_project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"history": {
"name": "history",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'backlog'"
},
"manager_id": {
"name": "manager_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"start_date": {
"name": "start_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"priority": {
"name": "priority",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_projects_tenant_id_tenants_id_fk": {
"name": "pc_projects_tenant_id_tenants_id_fk",
"tableFrom": "pc_projects",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_projects_user_id_users_id_fk": {
"name": "pc_projects_user_id_users_id_fk",
"tableFrom": "pc_projects",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_projects_client_id_crm_clients_id_fk": {
"name": "pc_projects_client_id_crm_clients_id_fk",
"tableFrom": "pc_projects",
"tableTo": "crm_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_projects_manager_id_users_id_fk": {
"name": "pc_projects_manager_id_users_id_fk",
"tableFrom": "pc_projects",
"tableTo": "users",
"columnsFrom": [
"manager_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_report_configurations": {
"name": "pc_report_configurations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"template_id": {
"name": "template_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sections": {
"name": "sections",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"section_options": {
"name": "section_options",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'{}'::jsonb"
},
"layout_options": {
"name": "layout_options",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'{}'::jsonb"
},
"filters": {
"name": "filters",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'{}'::jsonb"
},
"last_generated_at": {
"name": "last_generated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_by_id": {
"name": "created_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_report_configurations_tenant_id_tenants_id_fk": {
"name": "pc_report_configurations_tenant_id_tenants_id_fk",
"tableFrom": "pc_report_configurations",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_report_configurations_project_id_pc_projects_id_fk": {
"name": "pc_report_configurations_project_id_pc_projects_id_fk",
"tableFrom": "pc_report_configurations",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_report_configurations_template_id_pc_report_templates_id_fk": {
"name": "pc_report_configurations_template_id_pc_report_templates_id_fk",
"tableFrom": "pc_report_configurations",
"tableTo": "pc_report_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_report_configurations_created_by_id_users_id_fk": {
"name": "pc_report_configurations_created_by_id_users_id_fk",
"tableFrom": "pc_report_configurations",
"tableTo": "users",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_report_templates": {
"name": "pc_report_templates",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"template_type": {
"name": "template_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"sections": {
"name": "sections",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"is_default": {
"name": "is_default",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_requirements": {
"name": "pc_requirements",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'functional'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'medium'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": false
},
"acceptance_criteria": {
"name": "acceptance_criteria",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pdca_status": {
"name": "pdca_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'plan'"
},
"pdca_action_plan": {
"name": "pdca_action_plan",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pdca_result": {
"name": "pdca_result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_requirements_tenant_id_tenants_id_fk": {
"name": "pc_requirements_tenant_id_tenants_id_fk",
"tableFrom": "pc_requirements",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_requirements_project_id_pc_projects_id_fk": {
"name": "pc_requirements_project_id_pc_projects_id_fk",
"tableFrom": "pc_requirements",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_sprints": {
"name": "pc_sprints",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"squad_id": {
"name": "squad_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"goal": {
"name": "goal",
"type": "text",
"primaryKey": false,
"notNull": false
},
"start_date": {
"name": "start_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"end_date": {
"name": "end_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'planning'"
},
"velocity": {
"name": "velocity",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"completed_points": {
"name": "completed_points",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_sprints_tenant_id_tenants_id_fk": {
"name": "pc_sprints_tenant_id_tenants_id_fk",
"tableFrom": "pc_sprints",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_sprints_project_id_pc_projects_id_fk": {
"name": "pc_sprints_project_id_pc_projects_id_fk",
"tableFrom": "pc_sprints",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_sprints_squad_id_pc_squads_id_fk": {
"name": "pc_sprints_squad_id_pc_squads_id_fk",
"tableFrom": "pc_sprints",
"tableTo": "pc_squads",
"columnsFrom": [
"squad_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_squad_members": {
"name": "pc_squad_members",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"squad_id": {
"name": "squad_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"collaborator_id": {
"name": "collaborator_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"member_role": {
"name": "member_role",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'member'"
},
"joined_at": {
"name": "joined_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_squad_members_squad_id_pc_squads_id_fk": {
"name": "pc_squad_members_squad_id_pc_squads_id_fk",
"tableFrom": "pc_squad_members",
"tableTo": "pc_squads",
"columnsFrom": [
"squad_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_squad_members_user_id_users_id_fk": {
"name": "pc_squad_members_user_id_users_id_fk",
"tableFrom": "pc_squad_members",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_squads": {
"name": "pc_squads",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"leader_id": {
"name": "leader_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"product_owner_id": {
"name": "product_owner_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"tech_lead_id": {
"name": "tech_lead_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'#3b82f6'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_squads_tenant_id_tenants_id_fk": {
"name": "pc_squads_tenant_id_tenants_id_fk",
"tableFrom": "pc_squads",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_squads_leader_id_users_id_fk": {
"name": "pc_squads_leader_id_users_id_fk",
"tableFrom": "pc_squads",
"tableTo": "users",
"columnsFrom": [
"leader_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_swot_analyses": {
"name": "pc_swot_analyses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sector": {
"name": "sector",
"type": "text",
"primaryKey": false,
"notNull": false
},
"analysis_date": {
"name": "analysis_date",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_swot_analyses_project_id_pc_projects_id_fk": {
"name": "pc_swot_analyses_project_id_pc_projects_id_fk",
"tableFrom": "pc_swot_analyses",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_swot_items": {
"name": "pc_swot_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"swot_analysis_id": {
"name": "swot_analysis_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"impact": {
"name": "impact",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'medium'"
},
"impact_score": {
"name": "impact_score",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 3
},
"priority_level": {
"name": "priority_level",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'medium'"
},
"priority": {
"name": "priority",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"action_plan": {
"name": "action_plan",
"type": "text",
"primaryKey": false,
"notNull": false
},
"result": {
"name": "result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pdca_status": {
"name": "pdca_status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'plan'"
},
"responsible": {
"name": "responsible",
"type": "text",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'identified'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_swot_items_swot_analysis_id_pc_swot_analyses_id_fk": {
"name": "pc_swot_items_swot_analysis_id_pc_swot_analyses_id_fk",
"tableFrom": "pc_swot_items",
"tableTo": "pc_swot_analyses",
"columnsFrom": [
"swot_analysis_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_tasks": {
"name": "pc_tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"deliverable_id": {
"name": "deliverable_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'todo'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'medium'"
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"assigned_to_id": {
"name": "assigned_to_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_by_id": {
"name": "created_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"pc_tasks_project_id_pc_projects_id_fk": {
"name": "pc_tasks_project_id_pc_projects_id_fk",
"tableFrom": "pc_tasks",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_tasks_deliverable_id_pc_deliverables_id_fk": {
"name": "pc_tasks_deliverable_id_pc_deliverables_id_fk",
"tableFrom": "pc_tasks",
"tableTo": "pc_deliverables",
"columnsFrom": [
"deliverable_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_tasks_assigned_to_id_users_id_fk": {
"name": "pc_tasks_assigned_to_id_users_id_fk",
"tableFrom": "pc_tasks",
"tableTo": "users",
"columnsFrom": [
"assigned_to_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_tasks_created_by_id_users_id_fk": {
"name": "pc_tasks_created_by_id_users_id_fk",
"tableFrom": "pc_tasks",
"tableTo": "users",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_timesheet_entries": {
"name": "pc_timesheet_entries",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"work_item_id": {
"name": "work_item_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"sprint_id": {
"name": "sprint_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"collaborator_id": {
"name": "collaborator_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"date": {
"name": "date",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"hours": {
"name": "hours",
"type": "numeric(6, 2)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"billable": {
"name": "billable",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"hourly_rate": {
"name": "hourly_rate",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"total_cost": {
"name": "total_cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"timer_started_at": {
"name": "timer_started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"approved_by_id": {
"name": "approved_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"approved_at": {
"name": "approved_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_timesheet_entries_tenant_id_tenants_id_fk": {
"name": "pc_timesheet_entries_tenant_id_tenants_id_fk",
"tableFrom": "pc_timesheet_entries",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_timesheet_entries_work_item_id_pc_work_items_id_fk": {
"name": "pc_timesheet_entries_work_item_id_pc_work_items_id_fk",
"tableFrom": "pc_timesheet_entries",
"tableTo": "pc_work_items",
"columnsFrom": [
"work_item_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_timesheet_entries_project_id_pc_projects_id_fk": {
"name": "pc_timesheet_entries_project_id_pc_projects_id_fk",
"tableFrom": "pc_timesheet_entries",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_timesheet_entries_sprint_id_pc_sprints_id_fk": {
"name": "pc_timesheet_entries_sprint_id_pc_sprints_id_fk",
"tableFrom": "pc_timesheet_entries",
"tableTo": "pc_sprints",
"columnsFrom": [
"sprint_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_timesheet_entries_user_id_users_id_fk": {
"name": "pc_timesheet_entries_user_id_users_id_fk",
"tableFrom": "pc_timesheet_entries",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_timesheet_entries_approved_by_id_users_id_fk": {
"name": "pc_timesheet_entries_approved_by_id_users_id_fk",
"tableFrom": "pc_timesheet_entries",
"tableTo": "users",
"columnsFrom": [
"approved_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_work_item_comments": {
"name": "pc_work_item_comments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"work_item_id": {
"name": "work_item_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pc_work_item_comments_work_item_id_pc_work_items_id_fk": {
"name": "pc_work_item_comments_work_item_id_pc_work_items_id_fk",
"tableFrom": "pc_work_item_comments",
"tableTo": "pc_work_items",
"columnsFrom": [
"work_item_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_work_item_comments_user_id_users_id_fk": {
"name": "pc_work_item_comments_user_id_users_id_fk",
"tableFrom": "pc_work_item_comments",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pc_work_items": {
"name": "pc_work_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"sprint_id": {
"name": "sprint_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"parent_id": {
"name": "parent_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'task'"
},
"origin": {
"name": "origin",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'direct'"
},
"origin_id": {
"name": "origin_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"origin_type": {
"name": "origin_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'backlog'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'medium'"
},
"story_points": {
"name": "story_points",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"effort_score": {
"name": "effort_score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"estimated_hours": {
"name": "estimated_hours",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"actual_hours": {
"name": "actual_hours",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"hourly_rate": {
"name": "hourly_rate",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"total_cost": {
"name": "total_cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"assignee_id": {
"name": "assignee_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_by_id": {
"name": "created_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"pc_work_items_tenant_id_tenants_id_fk": {
"name": "pc_work_items_tenant_id_tenants_id_fk",
"tableFrom": "pc_work_items",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_work_items_project_id_pc_projects_id_fk": {
"name": "pc_work_items_project_id_pc_projects_id_fk",
"tableFrom": "pc_work_items",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pc_work_items_sprint_id_pc_sprints_id_fk": {
"name": "pc_work_items_sprint_id_pc_sprints_id_fk",
"tableFrom": "pc_work_items",
"tableTo": "pc_sprints",
"columnsFrom": [
"sprint_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"pc_work_items_assignee_id_users_id_fk": {
"name": "pc_work_items_assignee_id_users_id_fk",
"tableFrom": "pc_work_items",
"tableTo": "users",
"columnsFrom": [
"assignee_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pc_work_items_created_by_id_users_id_fk": {
"name": "pc_work_items_created_by_id_users_id_fk",
"tableFrom": "pc_work_items",
"tableTo": "users",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_beneficios": {
"name": "people_beneficios",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"nome": {
"name": "nome",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"fornecedor": {
"name": "fornecedor",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"valor_empresa": {
"name": "valor_empresa",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"valor_funcionario": {
"name": "valor_funcionario",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"percentual_desconto": {
"name": "percentual_desconto",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"evento_desconto_id": {
"name": "evento_desconto_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_beneficios_evento_desconto_id_people_eventos_folha_id_fk": {
"name": "people_beneficios_evento_desconto_id_people_eventos_folha_id_fk",
"tableFrom": "people_beneficios",
"tableTo": "people_eventos_folha",
"columnsFrom": [
"evento_desconto_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_cargos": {
"name": "people_cargos",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"nome": {
"name": "nome",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"descricao": {
"name": "descricao",
"type": "text",
"primaryKey": false,
"notNull": false
},
"cbo": {
"name": "cbo",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"nivel": {
"name": "nivel",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"departamento": {
"name": "departamento",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"salario_base": {
"name": "salario_base",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_departamentos": {
"name": "people_departamentos",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"nome": {
"name": "nome",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"centro_custo_id": {
"name": "centro_custo_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"gerente": {
"name": "gerente",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"departamento_pai": {
"name": "departamento_pai",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_departamentos_centro_custo_id_contabil_centros_custo_id_fk": {
"name": "people_departamentos_centro_custo_id_contabil_centros_custo_id_fk",
"tableFrom": "people_departamentos",
"tableTo": "contabil_centros_custo",
"columnsFrom": [
"centro_custo_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_dependentes": {
"name": "people_dependentes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"funcionario_id": {
"name": "funcionario_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"nome": {
"name": "nome",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"cpf": {
"name": "cpf",
"type": "varchar(14)",
"primaryKey": false,
"notNull": false
},
"data_nascimento": {
"name": "data_nascimento",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"parentesco": {
"name": "parentesco",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"irrf": {
"name": "irrf",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"salario_familia": {
"name": "salario_familia",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"plano_saude": {
"name": "plano_saude",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_dependentes_funcionario_id_people_funcionarios_id_fk": {
"name": "people_dependentes_funcionario_id_people_funcionarios_id_fk",
"tableFrom": "people_dependentes",
"tableTo": "people_funcionarios",
"columnsFrom": [
"funcionario_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_eventos_folha": {
"name": "people_eventos_folha",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"codigo": {
"name": "codigo",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
},
"nome": {
"name": "nome",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"natureza": {
"name": "natureza",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"incidencias": {
"name": "incidencias",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"formula": {
"name": "formula",
"type": "text",
"primaryKey": false,
"notNull": false
},
"conta_debito": {
"name": "conta_debito",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"conta_credito": {
"name": "conta_credito",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_eventos_folha_conta_debito_contabil_plano_contas_id_fk": {
"name": "people_eventos_folha_conta_debito_contabil_plano_contas_id_fk",
"tableFrom": "people_eventos_folha",
"tableTo": "contabil_plano_contas",
"columnsFrom": [
"conta_debito"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"people_eventos_folha_conta_credito_contabil_plano_contas_id_fk": {
"name": "people_eventos_folha_conta_credito_contabil_plano_contas_id_fk",
"tableFrom": "people_eventos_folha",
"tableTo": "contabil_plano_contas",
"columnsFrom": [
"conta_credito"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_ferias": {
"name": "people_ferias",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"funcionario_id": {
"name": "funcionario_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"periodo_aquisitivo_inicio": {
"name": "periodo_aquisitivo_inicio",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"periodo_aquisitivo_fim": {
"name": "periodo_aquisitivo_fim",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"dias_direito": {
"name": "dias_direito",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 30
},
"dias_gozados": {
"name": "dias_gozados",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"dias_vendidos": {
"name": "dias_vendidos",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"data_inicio": {
"name": "data_inicio",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"data_fim": {
"name": "data_fim",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"valor_ferias": {
"name": "valor_ferias",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"valor_terco": {
"name": "valor_terco",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"valor_abono": {
"name": "valor_abono",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pendente'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_ferias_funcionario_id_people_funcionarios_id_fk": {
"name": "people_ferias_funcionario_id_people_funcionarios_id_fk",
"tableFrom": "people_ferias",
"tableTo": "people_funcionarios",
"columnsFrom": [
"funcionario_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_folha_eventos": {
"name": "people_folha_eventos",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"folha_item_id": {
"name": "folha_item_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"evento_id": {
"name": "evento_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"referencia": {
"name": "referencia",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"valor": {
"name": "valor",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"people_folha_eventos_folha_item_id_people_folha_itens_id_fk": {
"name": "people_folha_eventos_folha_item_id_people_folha_itens_id_fk",
"tableFrom": "people_folha_eventos",
"tableTo": "people_folha_itens",
"columnsFrom": [
"folha_item_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"people_folha_eventos_evento_id_people_eventos_folha_id_fk": {
"name": "people_folha_eventos_evento_id_people_eventos_folha_id_fk",
"tableFrom": "people_folha_eventos",
"tableTo": "people_eventos_folha",
"columnsFrom": [
"evento_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_folha_itens": {
"name": "people_folha_itens",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"folha_id": {
"name": "folha_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"funcionario_id": {
"name": "funcionario_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"salario_base": {
"name": "salario_base",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"dias_trabalhados": {
"name": "dias_trabalhados",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"horas_extras_50": {
"name": "horas_extras_50",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"horas_extras_100": {
"name": "horas_extras_100",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"horas_noturnas": {
"name": "horas_noturnas",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"faltas": {
"name": "faltas",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"atrasos": {
"name": "atrasos",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_proventos": {
"name": "total_proventos",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_descontos": {
"name": "total_descontos",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_liquido": {
"name": "total_liquido",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"base_inss": {
"name": "base_inss",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_inss": {
"name": "valor_inss",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"base_irrf": {
"name": "base_irrf",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_irrf": {
"name": "valor_irrf",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"base_fgts": {
"name": "base_fgts",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"valor_fgts": {
"name": "valor_fgts",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
}
},
"indexes": {},
"foreignKeys": {
"people_folha_itens_folha_id_people_folha_pagamento_id_fk": {
"name": "people_folha_itens_folha_id_people_folha_pagamento_id_fk",
"tableFrom": "people_folha_itens",
"tableTo": "people_folha_pagamento",
"columnsFrom": [
"folha_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"people_folha_itens_funcionario_id_people_funcionarios_id_fk": {
"name": "people_folha_itens_funcionario_id_people_funcionarios_id_fk",
"tableFrom": "people_folha_itens",
"tableTo": "people_funcionarios",
"columnsFrom": [
"funcionario_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_folha_pagamento": {
"name": "people_folha_pagamento",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"competencia": {
"name": "competencia",
"type": "varchar(7)",
"primaryKey": false,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"data_calculo": {
"name": "data_calculo",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"data_pagamento": {
"name": "data_pagamento",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"total_bruto": {
"name": "total_bruto",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_descontos": {
"name": "total_descontos",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_liquido": {
"name": "total_liquido",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_inss": {
"name": "total_inss",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_irrf": {
"name": "total_irrf",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_fgts": {
"name": "total_fgts",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'aberta'"
},
"contabilizado": {
"name": "contabilizado",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"lancamento_contabil_id": {
"name": "lancamento_contabil_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_folha_pagamento_lancamento_contabil_id_contabil_lancamentos_id_fk": {
"name": "people_folha_pagamento_lancamento_contabil_id_contabil_lancamentos_id_fk",
"tableFrom": "people_folha_pagamento",
"tableTo": "contabil_lancamentos",
"columnsFrom": [
"lancamento_contabil_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"people_folha_pagamento_created_by_users_id_fk": {
"name": "people_folha_pagamento_created_by_users_id_fk",
"tableFrom": "people_folha_pagamento",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_funcionario_beneficios": {
"name": "people_funcionario_beneficios",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"funcionario_id": {
"name": "funcionario_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"beneficio_id": {
"name": "beneficio_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"data_inicio": {
"name": "data_inicio",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"data_fim": {
"name": "data_fim",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"valor_personalizado": {
"name": "valor_personalizado",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
}
},
"indexes": {},
"foreignKeys": {
"people_funcionario_beneficios_funcionario_id_people_funcionarios_id_fk": {
"name": "people_funcionario_beneficios_funcionario_id_people_funcionarios_id_fk",
"tableFrom": "people_funcionario_beneficios",
"tableTo": "people_funcionarios",
"columnsFrom": [
"funcionario_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"people_funcionario_beneficios_beneficio_id_people_beneficios_id_fk": {
"name": "people_funcionario_beneficios_beneficio_id_people_beneficios_id_fk",
"tableFrom": "people_funcionario_beneficios",
"tableTo": "people_beneficios",
"columnsFrom": [
"beneficio_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_funcionarios": {
"name": "people_funcionarios",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"matricula": {
"name": "matricula",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"nome": {
"name": "nome",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"cpf": {
"name": "cpf",
"type": "varchar(14)",
"primaryKey": false,
"notNull": false
},
"rg": {
"name": "rg",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"data_nascimento": {
"name": "data_nascimento",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"sexo": {
"name": "sexo",
"type": "varchar(1)",
"primaryKey": false,
"notNull": false
},
"estado_civil": {
"name": "estado_civil",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"nacionalidade": {
"name": "nacionalidade",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"naturalidade": {
"name": "naturalidade",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"nome_mae": {
"name": "nome_mae",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"nome_pai": {
"name": "nome_pai",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"telefone": {
"name": "telefone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"celular": {
"name": "celular",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"cep": {
"name": "cep",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"logradouro": {
"name": "logradouro",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"numero": {
"name": "numero",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"complemento": {
"name": "complemento",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"bairro": {
"name": "bairro",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"cidade": {
"name": "cidade",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"uf": {
"name": "uf",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"pis": {
"name": "pis",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"ctps": {
"name": "ctps",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"ctps_serie": {
"name": "ctps_serie",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"ctps_uf": {
"name": "ctps_uf",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"banco": {
"name": "banco",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"agencia": {
"name": "agencia",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"conta": {
"name": "conta",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"tipo_conta": {
"name": "tipo_conta",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"chave_pix": {
"name": "chave_pix",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"cargo_id": {
"name": "cargo_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"departamento_id": {
"name": "departamento_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"data_admissao": {
"name": "data_admissao",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"data_demissao": {
"name": "data_demissao",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"tipo_contrato": {
"name": "tipo_contrato",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"jornada_trabalho": {
"name": "jornada_trabalho",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"salario": {
"name": "salario",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"matricula_esocial": {
"name": "matricula_esocial",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"categoria_esocial": {
"name": "categoria_esocial",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'ativo'"
},
"foto": {
"name": "foto",
"type": "text",
"primaryKey": false,
"notNull": false
},
"observacoes": {
"name": "observacoes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_funcionarios_user_id_users_id_fk": {
"name": "people_funcionarios_user_id_users_id_fk",
"tableFrom": "people_funcionarios",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"people_funcionarios_cargo_id_people_cargos_id_fk": {
"name": "people_funcionarios_cargo_id_people_cargos_id_fk",
"tableFrom": "people_funcionarios",
"tableTo": "people_cargos",
"columnsFrom": [
"cargo_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"people_funcionarios_departamento_id_people_departamentos_id_fk": {
"name": "people_funcionarios_departamento_id_people_departamentos_id_fk",
"tableFrom": "people_funcionarios",
"tableTo": "people_departamentos",
"columnsFrom": [
"departamento_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_ponto": {
"name": "people_ponto",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"funcionario_id": {
"name": "funcionario_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"data": {
"name": "data",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"entrada1": {
"name": "entrada1",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"saida1": {
"name": "saida1",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"entrada2": {
"name": "entrada2",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"saida2": {
"name": "saida2",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"horas_trabalhadas": {
"name": "horas_trabalhadas",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"horas_extras": {
"name": "horas_extras",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"horas_noturnas": {
"name": "horas_noturnas",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"atraso": {
"name": "atraso",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"falta": {
"name": "falta",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"justificativa": {
"name": "justificativa",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'normal'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"people_ponto_funcionario_id_people_funcionarios_id_fk": {
"name": "people_ponto_funcionario_id_people_funcionarios_id_fk",
"tableFrom": "people_ponto",
"tableTo": "people_funcionarios",
"columnsFrom": [
"funcionario_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.people_tabelas_calculo": {
"name": "people_tabelas_calculo",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tipo": {
"name": "tipo",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"vigencia": {
"name": "vigencia",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"faixa_inicio": {
"name": "faixa_inicio",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"faixa_fim": {
"name": "faixa_fim",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"aliquota": {
"name": "aliquota",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"deducao": {
"name": "deducao",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
},
"valor": {
"name": "valor",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.permissions": {
"name": "permissions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"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
},
"module": {
"name": "module",
"type": "text",
"primaryKey": false,
"notNull": true
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"permissions_code_unique": {
"name": "permissions_code_unique",
"nullsNotDistinct": false,
"columns": [
"code"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.person_roles": {
"name": "person_roles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"person_id": {
"name": "person_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"role_type": {
"name": "role_type",
"type": "varchar(30)",
"primaryKey": false,
"notNull": true
},
"credit_limit": {
"name": "credit_limit",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"payment_terms": {
"name": "payment_terms",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"customer_since": {
"name": "customer_since",
"type": "date",
"primaryKey": false,
"notNull": false
},
"supplier_code": {
"name": "supplier_code",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"supplier_category": {
"name": "supplier_category",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"lead_time": {
"name": "lead_time",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"min_order_value": {
"name": "min_order_value",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"employee_code": {
"name": "employee_code",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"department": {
"name": "department",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"position": {
"name": "position",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"hire_date": {
"name": "hire_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"termination_date": {
"name": "termination_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"salary": {
"name": "salary",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"commission_rate": {
"name": "commission_rate",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"specializations": {
"name": "specializations",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"certifications": {
"name": "certifications",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"avg_repair_time": {
"name": "avg_repair_time",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"quality_score": {
"name": "quality_score",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"person_roles_person_id_persons_id_fk": {
"name": "person_roles_person_id_persons_id_fk",
"tableFrom": "person_roles",
"tableTo": "persons",
"columnsFrom": [
"person_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.persons": {
"name": "persons",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"full_name": {
"name": "full_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"cpf_cnpj": {
"name": "cpf_cnpj",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"rg_ie": {
"name": "rg_ie",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"phone2": {
"name": "phone2",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"whatsapp": {
"name": "whatsapp",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"address_number": {
"name": "address_number",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"complement": {
"name": "complement",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"neighborhood": {
"name": "neighborhood",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"zip_code": {
"name": "zip_code",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"country": {
"name": "country",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'Brasil'"
},
"birth_date": {
"name": "birth_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"gender": {
"name": "gender",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"photo_url": {
"name": "photo_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"erpnext_customer_id": {
"name": "erpnext_customer_id",
"type": "varchar(140)",
"primaryKey": false,
"notNull": false
},
"erpnext_supplier_id": {
"name": "erpnext_supplier_id",
"type": "varchar(140)",
"primaryKey": false,
"notNull": false
},
"erpnext_employee_id": {
"name": "erpnext_employee_id",
"type": "varchar(140)",
"primaryKey": false,
"notNull": false
},
"last_sync_at": {
"name": "last_sync_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"persons_tenant_id_tenants_id_fk": {
"name": "persons_tenant_id_tenants_id_fk",
"tableFrom": "persons",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pos_sale_items": {
"name": "pos_sale_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"sale_id": {
"name": "sale_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"item_type": {
"name": "item_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'product'"
},
"item_code": {
"name": "item_code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"item_name": {
"name": "item_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"unit_price": {
"name": "unit_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"discount_amount": {
"name": "discount_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_price": {
"name": "total_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pos_sale_items_sale_id_pos_sales_id_fk": {
"name": "pos_sale_items_sale_id_pos_sales_id_fk",
"tableFrom": "pos_sale_items",
"tableTo": "pos_sales",
"columnsFrom": [
"sale_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pos_sale_items_device_id_mobile_devices_id_fk": {
"name": "pos_sale_items_device_id_mobile_devices_id_fk",
"tableFrom": "pos_sale_items",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pos_sales": {
"name": "pos_sales",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"session_id": {
"name": "session_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"sale_number": {
"name": "sale_number",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"sale_type": {
"name": "sale_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'direct_sale'"
},
"customer_id": {
"name": "customer_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"customer_name": {
"name": "customer_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"customer_phone": {
"name": "customer_phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"customer_cpf": {
"name": "customer_cpf",
"type": "varchar(14)",
"primaryKey": false,
"notNull": false
},
"subtotal": {
"name": "subtotal",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"discount_amount": {
"name": "discount_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"discount_percent": {
"name": "discount_percent",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"trade_in_value": {
"name": "trade_in_value",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"trade_in_evaluation_id": {
"name": "trade_in_evaluation_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"total_amount": {
"name": "total_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"payment_method": {
"name": "payment_method",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"payment_details": {
"name": "payment_details",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"installments": {
"name": "installments",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"payment_plan_id": {
"name": "payment_plan_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'completed'"
},
"sold_by": {
"name": "sold_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pos_sales_tenant_id_tenants_id_fk": {
"name": "pos_sales_tenant_id_tenants_id_fk",
"tableFrom": "pos_sales",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pos_sales_session_id_pos_sessions_id_fk": {
"name": "pos_sales_session_id_pos_sessions_id_fk",
"tableFrom": "pos_sales",
"tableTo": "pos_sessions",
"columnsFrom": [
"session_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pos_sales_store_id_retail_stores_id_fk": {
"name": "pos_sales_store_id_retail_stores_id_fk",
"tableFrom": "pos_sales",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pos_sales_trade_in_evaluation_id_device_evaluations_id_fk": {
"name": "pos_sales_trade_in_evaluation_id_device_evaluations_id_fk",
"tableFrom": "pos_sales",
"tableTo": "device_evaluations",
"columnsFrom": [
"trade_in_evaluation_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pos_sessions": {
"name": "pos_sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"cashier_id": {
"name": "cashier_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"cashier_name": {
"name": "cashier_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"session_start_time": {
"name": "session_start_time",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"session_end_time": {
"name": "session_end_time",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"opening_balance": {
"name": "opening_balance",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"closing_balance": {
"name": "closing_balance",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false
},
"total_sales": {
"name": "total_sales",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_refunds": {
"name": "total_refunds",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"net_sales": {
"name": "net_sales",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"cash_payments": {
"name": "cash_payments",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"card_payments": {
"name": "card_payments",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"pix_payments": {
"name": "pix_payments",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"other_payments": {
"name": "other_payments",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"transaction_count": {
"name": "transaction_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'open'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"pos_sessions_tenant_id_tenants_id_fk": {
"name": "pos_sessions_tenant_id_tenants_id_fk",
"tableFrom": "pos_sessions",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pos_sessions_store_id_retail_stores_id_fk": {
"name": "pos_sessions_store_id_retail_stores_id_fk",
"tableFrom": "pos_sessions",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.products": {
"name": "products",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"unit": {
"name": "unit",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'UN'"
},
"cost_price": {
"name": "cost_price",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"sale_price": {
"name": "sale_price",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"stock_qty": {
"name": "stock_qty",
"type": "numeric(15, 3)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"min_stock": {
"name": "min_stock",
"type": "numeric(15, 3)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"barcode": {
"name": "barcode",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"ncm": {
"name": "ncm",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"tax_group_id": {
"name": "tax_group_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"image_url": {
"name": "image_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"products_tenant_id_tenants_id_fk": {
"name": "products_tenant_id_tenants_id_fk",
"tableFrom": "products",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"products_tax_group_id_fiscal_grupos_tributacao_id_fk": {
"name": "products_tax_group_id_fiscal_grupos_tributacao_id_fk",
"tableFrom": "products",
"tableTo": "fiscal_grupos_tributacao",
"columnsFrom": [
"tax_group_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.profiles": {
"name": "profiles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'custom'"
},
"allowed_modules": {
"name": "allowed_modules",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"is_system": {
"name": "is_system",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"profiles_name_unique": {
"name": "profiles_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.purchase_order_items": {
"name": "purchase_order_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"order_id": {
"name": "order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"product_name": {
"name": "product_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(15, 3)",
"primaryKey": false,
"notNull": true
},
"unit_price": {
"name": "unit_price",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"total": {
"name": "total",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"purchase_order_items_order_id_purchase_orders_id_fk": {
"name": "purchase_order_items_order_id_purchase_orders_id_fk",
"tableFrom": "purchase_order_items",
"tableTo": "purchase_orders",
"columnsFrom": [
"order_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"purchase_order_items_product_id_products_id_fk": {
"name": "purchase_order_items_product_id_products_id_fk",
"tableFrom": "purchase_order_items",
"tableTo": "products",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.purchase_orders": {
"name": "purchase_orders",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"order_number": {
"name": "order_number",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"supplier_id": {
"name": "supplier_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"order_date": {
"name": "order_date",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"expected_date": {
"name": "expected_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"subtotal": {
"name": "subtotal",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"discount": {
"name": "discount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"tax": {
"name": "tax",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total": {
"name": "total",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"purchase_orders_tenant_id_tenants_id_fk": {
"name": "purchase_orders_tenant_id_tenants_id_fk",
"tableFrom": "purchase_orders",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"purchase_orders_supplier_id_suppliers_id_fk": {
"name": "purchase_orders_supplier_id_suppliers_id_fk",
"tableFrom": "purchase_orders",
"tableTo": "suppliers",
"columnsFrom": [
"supplier_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"purchase_orders_created_by_users_id_fk": {
"name": "purchase_orders_created_by_users_id_fk",
"tableFrom": "purchase_orders",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quality_document_revisions": {
"name": "quality_document_revisions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"document_id": {
"name": "document_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"version": {
"name": "version",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"revision_number": {
"name": "revision_number",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"change_description": {
"name": "change_description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"revised_by": {
"name": "revised_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"revised_at": {
"name": "revised_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
},
"file_url": {
"name": "file_url",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"quality_document_revisions_document_id_quality_documents_id_fk": {
"name": "quality_document_revisions_document_id_quality_documents_id_fk",
"tableFrom": "quality_document_revisions",
"tableTo": "quality_documents",
"columnsFrom": [
"document_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"quality_document_revisions_revised_by_users_id_fk": {
"name": "quality_document_revisions_revised_by_users_id_fk",
"tableFrom": "quality_document_revisions",
"tableTo": "users",
"columnsFrom": [
"revised_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quality_documents": {
"name": "quality_documents",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"document_code": {
"name": "document_code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"category": {
"name": "category",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"version": {
"name": "version",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'01'"
},
"revision_number": {
"name": "revision_number",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'vigente'"
},
"effective_date": {
"name": "effective_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"expiry_date": {
"name": "expiry_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"next_review_date": {
"name": "next_review_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"author": {
"name": "author",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"approved_by": {
"name": "approved_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"approved_at": {
"name": "approved_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"file_url": {
"name": "file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"keywords": {
"name": "keywords",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"access_level": {
"name": "access_level",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'interno'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"quality_documents_tenant_id_tenants_id_fk": {
"name": "quality_documents_tenant_id_tenants_id_fk",
"tableFrom": "quality_documents",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_documents_approved_by_users_id_fk": {
"name": "quality_documents_approved_by_users_id_fk",
"tableFrom": "quality_documents",
"tableTo": "users",
"columnsFrom": [
"approved_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quality_field_forms": {
"name": "quality_field_forms",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"form_type": {
"name": "form_type",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"form_code": {
"name": "form_code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"collection_date": {
"name": "collection_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"coordinates": {
"name": "coordinates",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"responsible_id": {
"name": "responsible_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"team_members": {
"name": "team_members",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"weather_conditions": {
"name": "weather_conditions",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"form_data": {
"name": "form_data",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"photos": {
"name": "photos",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"signature": {
"name": "signature",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'rascunho'"
},
"synced_at": {
"name": "synced_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"observations": {
"name": "observations",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"quality_field_forms_tenant_id_tenants_id_fk": {
"name": "quality_field_forms_tenant_id_tenants_id_fk",
"tableFrom": "quality_field_forms",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_field_forms_project_id_pc_projects_id_fk": {
"name": "quality_field_forms_project_id_pc_projects_id_fk",
"tableFrom": "quality_field_forms",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"quality_field_forms_responsible_id_users_id_fk": {
"name": "quality_field_forms_responsible_id_users_id_fk",
"tableFrom": "quality_field_forms",
"tableTo": "users",
"columnsFrom": [
"responsible_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quality_lab_reports": {
"name": "quality_lab_reports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"sample_id": {
"name": "sample_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"report_number": {
"name": "report_number",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"laboratory_id": {
"name": "laboratory_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"issue_date": {
"name": "issue_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"reception_date": {
"name": "reception_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"parameters": {
"name": "parameters",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"conclusion": {
"name": "conclusion",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'recebido'"
},
"file_url": {
"name": "file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"observations": {
"name": "observations",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"quality_lab_reports_tenant_id_tenants_id_fk": {
"name": "quality_lab_reports_tenant_id_tenants_id_fk",
"tableFrom": "quality_lab_reports",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_lab_reports_sample_id_quality_samples_id_fk": {
"name": "quality_lab_reports_sample_id_quality_samples_id_fk",
"tableFrom": "quality_lab_reports",
"tableTo": "quality_samples",
"columnsFrom": [
"sample_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"quality_lab_reports_laboratory_id_suppliers_id_fk": {
"name": "quality_lab_reports_laboratory_id_suppliers_id_fk",
"tableFrom": "quality_lab_reports",
"tableTo": "suppliers",
"columnsFrom": [
"laboratory_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quality_non_conformities": {
"name": "quality_non_conformities",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"rnc_number": {
"name": "rnc_number",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'nao_conformidade'"
},
"source": {
"name": "source",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"severity": {
"name": "severity",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'media'"
},
"detected_by": {
"name": "detected_by",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"detected_at": {
"name": "detected_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"root_cause": {
"name": "root_cause",
"type": "text",
"primaryKey": false,
"notNull": false
},
"immediate_action": {
"name": "immediate_action",
"type": "text",
"primaryKey": false,
"notNull": false
},
"corrective_action": {
"name": "corrective_action",
"type": "text",
"primaryKey": false,
"notNull": false
},
"preventive_action": {
"name": "preventive_action",
"type": "text",
"primaryKey": false,
"notNull": false
},
"responsible_id": {
"name": "responsible_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"due_date": {
"name": "due_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"closed_at": {
"name": "closed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"closed_by": {
"name": "closed_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"verification_date": {
"name": "verification_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"verified_by": {
"name": "verified_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"effectiveness_verified": {
"name": "effectiveness_verified",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'aberta'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"quality_non_conformities_tenant_id_tenants_id_fk": {
"name": "quality_non_conformities_tenant_id_tenants_id_fk",
"tableFrom": "quality_non_conformities",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_non_conformities_project_id_pc_projects_id_fk": {
"name": "quality_non_conformities_project_id_pc_projects_id_fk",
"tableFrom": "quality_non_conformities",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"quality_non_conformities_responsible_id_users_id_fk": {
"name": "quality_non_conformities_responsible_id_users_id_fk",
"tableFrom": "quality_non_conformities",
"tableTo": "users",
"columnsFrom": [
"responsible_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_non_conformities_closed_by_users_id_fk": {
"name": "quality_non_conformities_closed_by_users_id_fk",
"tableFrom": "quality_non_conformities",
"tableTo": "users",
"columnsFrom": [
"closed_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_non_conformities_verified_by_users_id_fk": {
"name": "quality_non_conformities_verified_by_users_id_fk",
"tableFrom": "quality_non_conformities",
"tableTo": "users",
"columnsFrom": [
"verified_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quality_samples": {
"name": "quality_samples",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"sample_code": {
"name": "sample_code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"sample_type": {
"name": "sample_type",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"collection_date": {
"name": "collection_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"collection_location": {
"name": "collection_location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"collection_responsible": {
"name": "collection_responsible",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"collection_method": {
"name": "collection_method",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"preservation_method": {
"name": "preservation_method",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"laboratory_id": {
"name": "laboratory_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"sent_to_lab_date": {
"name": "sent_to_lab_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"lab_reception_date": {
"name": "lab_reception_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"expected_result_date": {
"name": "expected_result_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"actual_result_date": {
"name": "actual_result_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'coletada'"
},
"observations": {
"name": "observations",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"quality_samples_tenant_id_tenants_id_fk": {
"name": "quality_samples_tenant_id_tenants_id_fk",
"tableFrom": "quality_samples",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_samples_project_id_pc_projects_id_fk": {
"name": "quality_samples_project_id_pc_projects_id_fk",
"tableFrom": "quality_samples",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"quality_samples_laboratory_id_suppliers_id_fk": {
"name": "quality_samples_laboratory_id_suppliers_id_fk",
"tableFrom": "quality_samples",
"tableTo": "suppliers",
"columnsFrom": [
"laboratory_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quality_training_matrix": {
"name": "quality_training_matrix",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"employee_id": {
"name": "employee_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"training_name": {
"name": "training_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"training_type": {
"name": "training_type",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"provider": {
"name": "provider",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"completed_date": {
"name": "completed_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"expiry_date": {
"name": "expiry_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"certificate_url": {
"name": "certificate_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"hours": {
"name": "hours",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'pendente'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"quality_training_matrix_tenant_id_tenants_id_fk": {
"name": "quality_training_matrix_tenant_id_tenants_id_fk",
"tableFrom": "quality_training_matrix",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"quality_training_matrix_employee_id_users_id_fk": {
"name": "quality_training_matrix_employee_id_users_id_fk",
"tableFrom": "quality_training_matrix",
"tableTo": "users",
"columnsFrom": [
"employee_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quick_notes": {
"name": "quick_notes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_pinned": {
"name": "is_pinned",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"quick_notes_user_id_users_id_fk": {
"name": "quick_notes_user_id_users_id_fk",
"tableFrom": "quick_notes",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.retail_stores": {
"name": "retail_stores",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"store_type": {
"name": "store_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'store'"
},
"parent_store_id": {
"name": "parent_store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"warehouse_id": {
"name": "warehouse_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"cnpj": {
"name": "cnpj",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"legal_name": {
"name": "legal_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"zip_code": {
"name": "zip_code",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"manager_id": {
"name": "manager_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"pos_enabled": {
"name": "pos_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"service_enabled": {
"name": "service_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"lease_enabled": {
"name": "lease_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"retail_stores_tenant_id_tenants_id_fk": {
"name": "retail_stores_tenant_id_tenants_id_fk",
"tableFrom": "retail_stores",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.retail_warehouses": {
"name": "retail_warehouses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"parent_store_id": {
"name": "parent_store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_main_warehouse": {
"name": "is_main_warehouse",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "varchar(2)",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"manager_id": {
"name": "manager_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"retail_warehouses_tenant_id_tenants_id_fk": {
"name": "retail_warehouses_tenant_id_tenants_id_fk",
"tableFrom": "retail_warehouses",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"retail_warehouses_parent_store_id_retail_stores_id_fk": {
"name": "retail_warehouses_parent_store_id_retail_stores_id_fk",
"tableFrom": "retail_warehouses",
"tableTo": "retail_stores",
"columnsFrom": [
"parent_store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.return_exchange_items": {
"name": "return_exchange_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"return_id": {
"name": "return_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"item_code": {
"name": "item_code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"item_name": {
"name": "item_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"reason": {
"name": "reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"refund_amount": {
"name": "refund_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"return_exchange_items_return_id_return_exchanges_id_fk": {
"name": "return_exchange_items_return_id_return_exchanges_id_fk",
"tableFrom": "return_exchange_items",
"tableTo": "return_exchanges",
"columnsFrom": [
"return_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"return_exchange_items_device_id_mobile_devices_id_fk": {
"name": "return_exchange_items_device_id_mobile_devices_id_fk",
"tableFrom": "return_exchange_items",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.return_exchanges": {
"name": "return_exchanges",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"return_number": {
"name": "return_number",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"original_sale_id": {
"name": "original_sale_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"customer_id": {
"name": "customer_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"customer_name": {
"name": "customer_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"return_type": {
"name": "return_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'return'"
},
"reason": {
"name": "reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"refund_amount": {
"name": "refund_amount",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"refund_method": {
"name": "refund_method",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"processed_by": {
"name": "processed_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"return_date": {
"name": "return_date",
"type": "date",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_DATE"
},
"processed_date": {
"name": "processed_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"return_exchanges_tenant_id_tenants_id_fk": {
"name": "return_exchanges_tenant_id_tenants_id_fk",
"tableFrom": "return_exchanges",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"return_exchanges_store_id_retail_stores_id_fk": {
"name": "return_exchanges_store_id_retail_stores_id_fk",
"tableFrom": "return_exchanges",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"return_exchanges_original_sale_id_pos_sales_id_fk": {
"name": "return_exchanges_original_sale_id_pos_sales_id_fk",
"tableFrom": "return_exchanges",
"tableTo": "pos_sales",
"columnsFrom": [
"original_sale_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.role_permissions": {
"name": "role_permissions",
"schema": "",
"columns": {
"role_id": {
"name": "role_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"permission_id": {
"name": "permission_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"role_permissions_role_id_roles_id_fk": {
"name": "role_permissions_role_id_roles_id_fk",
"tableFrom": "role_permissions",
"tableTo": "roles",
"columnsFrom": [
"role_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"role_permissions_permission_id_permissions_id_fk": {
"name": "role_permissions_permission_id_permissions_id_fk",
"tableFrom": "role_permissions",
"tableTo": "permissions",
"columnsFrom": [
"permission_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"role_permissions_role_id_permission_id_pk": {
"name": "role_permissions_role_id_permission_id_pk",
"columns": [
"role_id",
"permission_id"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.roles": {
"name": "roles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"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": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"roles_name_unique": {
"name": "roles_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.sales_order_items": {
"name": "sales_order_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"order_id": {
"name": "order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"product_name": {
"name": "product_name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(15, 3)",
"primaryKey": false,
"notNull": true
},
"unit_price": {
"name": "unit_price",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
},
"discount": {
"name": "discount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total": {
"name": "total",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"sales_order_items_order_id_sales_orders_id_fk": {
"name": "sales_order_items_order_id_sales_orders_id_fk",
"tableFrom": "sales_order_items",
"tableTo": "sales_orders",
"columnsFrom": [
"order_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"sales_order_items_product_id_products_id_fk": {
"name": "sales_order_items_product_id_products_id_fk",
"tableFrom": "sales_order_items",
"tableTo": "products",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.sales_orders": {
"name": "sales_orders",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"order_number": {
"name": "order_number",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"customer_id": {
"name": "customer_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"order_date": {
"name": "order_date",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"delivery_date": {
"name": "delivery_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"subtotal": {
"name": "subtotal",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"discount": {
"name": "discount",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"tax": {
"name": "tax",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total": {
"name": "total",
"type": "numeric(15, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"payment_method": {
"name": "payment_method",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"sales_orders_tenant_id_tenants_id_fk": {
"name": "sales_orders_tenant_id_tenants_id_fk",
"tableFrom": "sales_orders",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"sales_orders_customer_id_customers_id_fk": {
"name": "sales_orders_customer_id_customers_id_fk",
"tableFrom": "sales_orders",
"tableTo": "customers",
"columnsFrom": [
"customer_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"sales_orders_created_by_users_id_fk": {
"name": "sales_orders_created_by_users_id_fk",
"tableFrom": "sales_orders",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.scheduled_tasks": {
"name": "scheduled_tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"automation_id": {
"name": "automation_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"cron_expression": {
"name": "cron_expression",
"type": "text",
"primaryKey": false,
"notNull": false
},
"interval_minutes": {
"name": "interval_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"next_run_at": {
"name": "next_run_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"last_run_at": {
"name": "last_run_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
}
},
"indexes": {},
"foreignKeys": {
"scheduled_tasks_automation_id_automations_id_fk": {
"name": "scheduled_tasks_automation_id_automations_id_fk",
"tableFrom": "scheduled_tasks",
"tableTo": "automations",
"columnsFrom": [
"automation_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.service_order_items": {
"name": "service_order_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"service_order_id": {
"name": "service_order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"item_type": {
"name": "item_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'part'"
},
"item_code": {
"name": "item_code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"item_name": {
"name": "item_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"unit_price": {
"name": "unit_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"total_price": {
"name": "total_price",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"service_order_items_service_order_id_service_orders_id_fk": {
"name": "service_order_items_service_order_id_service_orders_id_fk",
"tableFrom": "service_order_items",
"tableTo": "service_orders",
"columnsFrom": [
"service_order_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.service_orders": {
"name": "service_orders",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"order_number": {
"name": "order_number",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"brand": {
"name": "brand",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"model": {
"name": "model",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"customer_id": {
"name": "customer_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"customer_name": {
"name": "customer_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"customer_phone": {
"name": "customer_phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"customer_email": {
"name": "customer_email",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"person_id": {
"name": "person_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"service_type": {
"name": "service_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'repair'"
},
"issue_description": {
"name": "issue_description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"diagnosis_notes": {
"name": "diagnosis_notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"origin": {
"name": "origin",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'customer_request'"
},
"assigned_to": {
"name": "assigned_to",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"technician_name": {
"name": "technician_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"technician_person_id": {
"name": "technician_person_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"parts_cost": {
"name": "parts_cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"labor_cost": {
"name": "labor_cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"total_cost": {
"name": "total_cost",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"expected_completion_date": {
"name": "expected_completion_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"actual_completion_date": {
"name": "actual_completion_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"payment_status": {
"name": "payment_status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'open'"
},
"priority": {
"name": "priority",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'normal'"
},
"is_internal": {
"name": "is_internal",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"internal_type": {
"name": "internal_type",
"type": "varchar(30)",
"primaryKey": false,
"notNull": false
},
"source_evaluation_id": {
"name": "source_evaluation_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"erpnext_doc_type": {
"name": "erpnext_doc_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"erpnext_doc_name": {
"name": "erpnext_doc_name",
"type": "varchar(140)",
"primaryKey": false,
"notNull": false
},
"last_sync_at": {
"name": "last_sync_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"service_orders_tenant_id_tenants_id_fk": {
"name": "service_orders_tenant_id_tenants_id_fk",
"tableFrom": "service_orders",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"service_orders_store_id_retail_stores_id_fk": {
"name": "service_orders_store_id_retail_stores_id_fk",
"tableFrom": "service_orders",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"service_orders_device_id_mobile_devices_id_fk": {
"name": "service_orders_device_id_mobile_devices_id_fk",
"tableFrom": "service_orders",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.staged_tables": {
"name": "staged_tables",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"source_type": {
"name": "source_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"source_file": {
"name": "source_file",
"type": "text",
"primaryKey": false,
"notNull": false
},
"table_name": {
"name": "table_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"columns": {
"name": "columns",
"type": "text",
"primaryKey": false,
"notNull": false
},
"row_count": {
"name": "row_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'ready'"
},
"target_erp": {
"name": "target_erp",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"staged_tables_user_id_users_id_fk": {
"name": "staged_tables_user_id_users_id_fk",
"tableFrom": "staged_tables",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.staging_mappings": {
"name": "staging_mappings",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"staged_table_id": {
"name": "staged_table_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"target_erp": {
"name": "target_erp",
"type": "text",
"primaryKey": false,
"notNull": true
},
"target_entity": {
"name": "target_entity",
"type": "text",
"primaryKey": false,
"notNull": true
},
"field_mappings": {
"name": "field_mappings",
"type": "text",
"primaryKey": false,
"notNull": true
},
"filters": {
"name": "filters",
"type": "text",
"primaryKey": false,
"notNull": false
},
"transformations": {
"name": "transformations",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"staging_mappings_staged_table_id_staged_tables_id_fk": {
"name": "staging_mappings_staged_table_id_staged_tables_id_fk",
"tableFrom": "staging_mappings",
"tableTo": "staged_tables",
"columnsFrom": [
"staged_table_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.stock_transfer_items": {
"name": "stock_transfer_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"transfer_id": {
"name": "transfer_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"device_id": {
"name": "device_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"imei": {
"name": "imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"stock_transfer_items_transfer_id_stock_transfers_id_fk": {
"name": "stock_transfer_items_transfer_id_stock_transfers_id_fk",
"tableFrom": "stock_transfer_items",
"tableTo": "stock_transfers",
"columnsFrom": [
"transfer_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"stock_transfer_items_device_id_mobile_devices_id_fk": {
"name": "stock_transfer_items_device_id_mobile_devices_id_fk",
"tableFrom": "stock_transfer_items",
"tableTo": "mobile_devices",
"columnsFrom": [
"device_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.stock_transfers": {
"name": "stock_transfers",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"transfer_number": {
"name": "transfer_number",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"from_warehouse_id": {
"name": "from_warehouse_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"from_store_id": {
"name": "from_store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"to_warehouse_id": {
"name": "to_warehouse_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"to_store_id": {
"name": "to_store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"requested_date": {
"name": "requested_date",
"type": "date",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_DATE"
},
"shipped_date": {
"name": "shipped_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"received_date": {
"name": "received_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"tracking_number": {
"name": "tracking_number",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"total_items": {
"name": "total_items",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"requested_by": {
"name": "requested_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"approved_by": {
"name": "approved_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"received_by": {
"name": "received_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"stock_transfers_tenant_id_tenants_id_fk": {
"name": "stock_transfers_tenant_id_tenants_id_fk",
"tableFrom": "stock_transfers",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"stock_transfers_from_warehouse_id_retail_warehouses_id_fk": {
"name": "stock_transfers_from_warehouse_id_retail_warehouses_id_fk",
"tableFrom": "stock_transfers",
"tableTo": "retail_warehouses",
"columnsFrom": [
"from_warehouse_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"stock_transfers_from_store_id_retail_stores_id_fk": {
"name": "stock_transfers_from_store_id_retail_stores_id_fk",
"tableFrom": "stock_transfers",
"tableTo": "retail_stores",
"columnsFrom": [
"from_store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"stock_transfers_to_warehouse_id_retail_warehouses_id_fk": {
"name": "stock_transfers_to_warehouse_id_retail_warehouses_id_fk",
"tableFrom": "stock_transfers",
"tableTo": "retail_warehouses",
"columnsFrom": [
"to_warehouse_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"stock_transfers_to_store_id_retail_stores_id_fk": {
"name": "stock_transfers_to_store_id_retail_stores_id_fk",
"tableFrom": "stock_transfers",
"tableTo": "retail_stores",
"columnsFrom": [
"to_store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.suppliers": {
"name": "suppliers",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"tax_id": {
"name": "tax_id",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"city": {
"name": "city",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"state": {
"name": "state",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"country": {
"name": "country",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false,
"default": "'Brasil'"
},
"payment_terms": {
"name": "payment_terms",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 30
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_homologated": {
"name": "is_homologated",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"homologation_date": {
"name": "homologation_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"homologation_expiry": {
"name": "homologation_expiry",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"homologation_status": {
"name": "homologation_status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"certifications": {
"name": "certifications",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"quality_score": {
"name": "quality_score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"last_audit_date": {
"name": "last_audit_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"next_audit_date": {
"name": "next_audit_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"blocked_for_purchase": {
"name": "blocked_for_purchase",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"block_reason": {
"name": "block_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"suppliers_tenant_id_tenants_id_fk": {
"name": "suppliers_tenant_id_tenants_id_fk",
"tableFrom": "suppliers",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.support_conversations": {
"name": "support_conversations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"ticket_id": {
"name": "ticket_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"sender_type": {
"name": "sender_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_ai_generated": {
"name": "is_ai_generated",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"ai_model": {
"name": "ai_model",
"type": "text",
"primaryKey": false,
"notNull": false
},
"attachments": {
"name": "attachments",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"support_conversations_ticket_id_support_tickets_id_fk": {
"name": "support_conversations_ticket_id_support_tickets_id_fk",
"tableFrom": "support_conversations",
"tableTo": "support_tickets",
"columnsFrom": [
"ticket_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"support_conversations_user_id_users_id_fk": {
"name": "support_conversations_user_id_users_id_fk",
"tableFrom": "support_conversations",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.support_knowledge_base": {
"name": "support_knowledge_base",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": false
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'published'"
},
"view_count": {
"name": "view_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"helpful_count": {
"name": "helpful_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"author_id": {
"name": "author_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"support_knowledge_base_tenant_id_tenants_id_fk": {
"name": "support_knowledge_base_tenant_id_tenants_id_fk",
"tableFrom": "support_knowledge_base",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"support_knowledge_base_author_id_users_id_fk": {
"name": "support_knowledge_base_author_id_users_id_fk",
"tableFrom": "support_knowledge_base",
"tableTo": "users",
"columnsFrom": [
"author_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.support_tickets": {
"name": "support_tickets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"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,
"default": "'general'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'medium'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'open'"
},
"channel": {
"name": "channel",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'portal'"
},
"assignee_id": {
"name": "assignee_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_by_id": {
"name": "created_by_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"work_item_id": {
"name": "work_item_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"resolved_at": {
"name": "resolved_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"first_response_at": {
"name": "first_response_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"closed_at": {
"name": "closed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"sla_deadline": {
"name": "sla_deadline",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"satisfaction": {
"name": "satisfaction",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"tags": {
"name": "tags",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"support_tickets_tenant_id_tenants_id_fk": {
"name": "support_tickets_tenant_id_tenants_id_fk",
"tableFrom": "support_tickets",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"support_tickets_client_id_crm_clients_id_fk": {
"name": "support_tickets_client_id_crm_clients_id_fk",
"tableFrom": "support_tickets",
"tableTo": "crm_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"support_tickets_project_id_pc_projects_id_fk": {
"name": "support_tickets_project_id_pc_projects_id_fk",
"tableFrom": "support_tickets",
"tableTo": "pc_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"support_tickets_assignee_id_users_id_fk": {
"name": "support_tickets_assignee_id_users_id_fk",
"tableFrom": "support_tickets",
"tableTo": "users",
"columnsFrom": [
"assignee_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"support_tickets_created_by_id_users_id_fk": {
"name": "support_tickets_created_by_id_users_id_fk",
"tableFrom": "support_tickets",
"tableTo": "users",
"columnsFrom": [
"created_by_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"support_tickets_work_item_id_pc_work_items_id_fk": {
"name": "support_tickets_work_item_id_pc_work_items_id_fk",
"tableFrom": "support_tickets",
"tableTo": "pc_work_items",
"columnsFrom": [
"work_item_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.task_executions": {
"name": "task_executions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"task_id": {
"name": "task_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true
},
"result": {
"name": "result",
"type": "text",
"primaryKey": false,
"notNull": false
},
"error": {
"name": "error",
"type": "text",
"primaryKey": false,
"notNull": false
},
"started_at": {
"name": "started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"task_executions_task_id_agent_tasks_id_fk": {
"name": "task_executions_task_id_agent_tasks_id_fk",
"tableFrom": "task_executions",
"tableTo": "agent_tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tenant_plans": {
"name": "tenant_plans",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"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
},
"tenant_type": {
"name": "tenant_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"max_users": {
"name": "max_users",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 5
},
"max_storage_mb": {
"name": "max_storage_mb",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1000
},
"features": {
"name": "features",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"monthly_price": {
"name": "monthly_price",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"yearly_price": {
"name": "yearly_price",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"trial_days": {
"name": "trial_days",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 14
},
"is_active": {
"name": "is_active",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'true'"
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"tenant_plans_code_unique": {
"name": "tenant_plans_code_unique",
"nullsNotDistinct": false,
"columns": [
"code"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tenant_production_settings": {
"name": "tenant_production_settings",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"timesheet_requires_approval": {
"name": "timesheet_requires_approval",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"timesheet_allow_timer": {
"name": "timesheet_allow_timer",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"default_hourly_rate": {
"name": "default_hourly_rate",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"work_hours_per_day": {
"name": "work_hours_per_day",
"type": "numeric(4, 2)",
"primaryKey": false,
"notNull": false,
"default": "'8'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"tenant_production_settings_tenant_id_tenants_id_fk": {
"name": "tenant_production_settings_tenant_id_tenants_id_fk",
"tableFrom": "tenant_production_settings",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"tenant_production_settings_tenant_id_unique": {
"name": "tenant_production_settings_tenant_id_unique",
"nullsNotDistinct": false,
"columns": [
"tenant_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tenant_users": {
"name": "tenant_users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'member'"
},
"is_owner": {
"name": "is_owner",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"tenant_users_tenant_id_tenants_id_fk": {
"name": "tenant_users_tenant_id_tenants_id_fk",
"tableFrom": "tenant_users",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"tenant_users_user_id_users_id_fk": {
"name": "tenant_users_user_id_users_id_fk",
"tableFrom": "tenant_users",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tenants": {
"name": "tenants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"logo_url": {
"name": "logo_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"plan": {
"name": "plan",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'free'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"settings": {
"name": "settings",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"tenant_type": {
"name": "tenant_type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'client'"
},
"parent_tenant_id": {
"name": "parent_tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"partner_code": {
"name": "partner_code",
"type": "text",
"primaryKey": false,
"notNull": false
},
"commission_rate": {
"name": "commission_rate",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"max_users": {
"name": "max_users",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 5
},
"max_storage_mb": {
"name": "max_storage_mb",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1000
},
"features": {
"name": "features",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"billing_email": {
"name": "billing_email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"trial_ends_at": {
"name": "trial_ends_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"commercial_contact": {
"name": "commercial_contact",
"type": "text",
"primaryKey": false,
"notNull": false
},
"commercial_phone": {
"name": "commercial_phone",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"tenants_slug_unique": {
"name": "tenants_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.trade_in_checklist_items": {
"name": "trade_in_checklist_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"template_id": {
"name": "template_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"item_name": {
"name": "item_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"item_description": {
"name": "item_description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"evaluation_type": {
"name": "evaluation_type",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'condition'"
},
"options": {
"name": "options",
"type": "text",
"primaryKey": false,
"notNull": false
},
"impact_on_value": {
"name": "impact_on_value",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"is_required": {
"name": "is_required",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"display_order": {
"name": "display_order",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"trade_in_checklist_items_template_id_trade_in_checklist_templates_id_fk": {
"name": "trade_in_checklist_items_template_id_trade_in_checklist_templates_id_fk",
"tableFrom": "trade_in_checklist_items",
"tableTo": "trade_in_checklist_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.trade_in_checklist_templates": {
"name": "trade_in_checklist_templates",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"device_category": {
"name": "device_category",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false,
"default": "'smartphone'"
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"trade_in_checklist_templates_tenant_id_tenants_id_fk": {
"name": "trade_in_checklist_templates_tenant_id_tenants_id_fk",
"tableFrom": "trade_in_checklist_templates",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.trade_in_evaluation_results": {
"name": "trade_in_evaluation_results",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"evaluation_id": {
"name": "evaluation_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"checklist_item_id": {
"name": "checklist_item_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"result": {
"name": "result",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"percent_value": {
"name": "percent_value",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"trade_in_evaluation_results_evaluation_id_device_evaluations_id_fk": {
"name": "trade_in_evaluation_results_evaluation_id_device_evaluations_id_fk",
"tableFrom": "trade_in_evaluation_results",
"tableTo": "device_evaluations",
"columnsFrom": [
"evaluation_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"trade_in_evaluation_results_checklist_item_id_trade_in_checklist_items_id_fk": {
"name": "trade_in_evaluation_results_checklist_item_id_trade_in_checklist_items_id_fk",
"tableFrom": "trade_in_evaluation_results",
"tableTo": "trade_in_checklist_items",
"columnsFrom": [
"checklist_item_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.trade_in_transfer_documents": {
"name": "trade_in_transfer_documents",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"store_id": {
"name": "store_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"evaluation_id": {
"name": "evaluation_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"document_number": {
"name": "document_number",
"type": "varchar(30)",
"primaryKey": false,
"notNull": true
},
"customer_name": {
"name": "customer_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"customer_cpf": {
"name": "customer_cpf",
"type": "varchar(14)",
"primaryKey": false,
"notNull": false
},
"customer_rg": {
"name": "customer_rg",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"customer_address": {
"name": "customer_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"customer_phone": {
"name": "customer_phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"customer_email": {
"name": "customer_email",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"device_brand": {
"name": "device_brand",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"device_model": {
"name": "device_model",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"device_imei": {
"name": "device_imei",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"device_imei2": {
"name": "device_imei2",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"device_color": {
"name": "device_color",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"device_storage": {
"name": "device_storage",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"device_condition": {
"name": "device_condition",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"agreed_value": {
"name": "agreed_value",
"type": "numeric(12, 2)",
"primaryKey": false,
"notNull": true
},
"payment_method": {
"name": "payment_method",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"customer_signature": {
"name": "customer_signature",
"type": "text",
"primaryKey": false,
"notNull": false
},
"customer_signed_at": {
"name": "customer_signed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"employee_signature": {
"name": "employee_signature",
"type": "text",
"primaryKey": false,
"notNull": false
},
"employee_name": {
"name": "employee_name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"employee_signed_at": {
"name": "employee_signed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"terms_accepted": {
"name": "terms_accepted",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"pdf_url": {
"name": "pdf_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"trade_in_transfer_documents_tenant_id_tenants_id_fk": {
"name": "trade_in_transfer_documents_tenant_id_tenants_id_fk",
"tableFrom": "trade_in_transfer_documents",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"trade_in_transfer_documents_store_id_retail_stores_id_fk": {
"name": "trade_in_transfer_documents_store_id_retail_stores_id_fk",
"tableFrom": "trade_in_transfer_documents",
"tableTo": "retail_stores",
"columnsFrom": [
"store_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"trade_in_transfer_documents_evaluation_id_device_evaluations_id_fk": {
"name": "trade_in_transfer_documents_evaluation_id_device_evaluations_id_fk",
"tableFrom": "trade_in_transfer_documents",
"tableTo": "device_evaluations",
"columnsFrom": [
"evaluation_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_applications": {
"name": "user_applications",
"schema": "",
"columns": {
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"application_id": {
"name": "application_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"user_applications_user_id_users_id_fk": {
"name": "user_applications_user_id_users_id_fk",
"tableFrom": "user_applications",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_applications_application_id_applications_id_fk": {
"name": "user_applications_application_id_applications_id_fk",
"tableFrom": "user_applications",
"tableTo": "applications",
"columnsFrom": [
"application_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"user_applications_user_id_application_id_pk": {
"name": "user_applications_user_id_application_id_pk",
"columns": [
"user_id",
"application_id"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_favorites": {
"name": "user_favorites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"module": {
"name": "module",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity_type": {
"name": "entity_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity_id": {
"name": "entity_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"entity_title": {
"name": "entity_title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"entity_icon": {
"name": "entity_icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"user_favorites_user_id_users_id_fk": {
"name": "user_favorites_user_id_users_id_fk",
"tableFrom": "user_favorites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_roles": {
"name": "user_roles",
"schema": "",
"columns": {
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"role_id": {
"name": "role_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"assigned_at": {
"name": "assigned_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"user_roles_user_id_users_id_fk": {
"name": "user_roles_user_id_users_id_fk",
"tableFrom": "user_roles",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_roles_role_id_roles_id_fk": {
"name": "user_roles_role_id_roles_id_fk",
"tableFrom": "user_roles",
"tableTo": "roles",
"columnsFrom": [
"role_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"user_roles_user_id_role_id_pk": {
"name": "user_roles_user_id_role_id_pk",
"columns": [
"user_id",
"role_id"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true
},
"password": {
"name": "password",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'user'"
},
"profile_id": {
"name": "profile_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"partner_id": {
"name": "partner_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"collaborator_type": {
"name": "collaborator_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"hourly_rate": {
"name": "hourly_rate",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false,
"default": "'0'"
},
"skills": {
"name": "skills",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"last_login_at": {
"name": "last_login_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_username_unique": {
"name": "users_username_unique",
"nullsNotDistinct": false,
"columns": [
"username"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_agent_insights": {
"name": "valuation_agent_insights",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"confidence": {
"name": "confidence",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"applied_at": {
"name": "applied_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"applied_by": {
"name": "applied_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_agent_insights_project_id_valuation_projects_id_fk": {
"name": "valuation_agent_insights_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_agent_insights",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_agent_insights_applied_by_users_id_fk": {
"name": "valuation_agent_insights_applied_by_users_id_fk",
"tableFrom": "valuation_agent_insights",
"tableTo": "users",
"columnsFrom": [
"applied_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_assumptions": {
"name": "valuation_assumptions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true
},
"value": {
"name": "value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"unit": {
"name": "unit",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_assumptions_project_id_valuation_projects_id_fk": {
"name": "valuation_assumptions_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_assumptions",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_calculations": {
"name": "valuation_calculations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"method": {
"name": "method",
"type": "text",
"primaryKey": false,
"notNull": true
},
"weight": {
"name": "weight",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"enterprise_value": {
"name": "enterprise_value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"equity_value": {
"name": "equity_value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"assumptions": {
"name": "assumptions",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"sensitivity_matrix": {
"name": "sensitivity_matrix",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"details": {
"name": "details",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"version": {
"name": "version",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"calculated_at": {
"name": "calculated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"calculated_by": {
"name": "calculated_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"valuation_calculations_project_id_valuation_projects_id_fk": {
"name": "valuation_calculations_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_calculations",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_calculations_calculated_by_users_id_fk": {
"name": "valuation_calculations_calculated_by_users_id_fk",
"tableFrom": "valuation_calculations",
"tableTo": "users",
"columnsFrom": [
"calculated_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_canvas": {
"name": "valuation_canvas",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"block": {
"name": "block",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_canvas_project_id_valuation_projects_id_fk": {
"name": "valuation_canvas_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_canvas",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_canvas_blocks": {
"name": "valuation_canvas_blocks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"block_type": {
"name": "block_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"items": {
"name": "items",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_canvas_blocks_project_id_valuation_projects_id_fk": {
"name": "valuation_canvas_blocks_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_canvas_blocks",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_canvas_snapshots": {
"name": "valuation_canvas_snapshots",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"canvas_data": {
"name": "canvas_data",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"consistency_score": {
"name": "consistency_score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"consistency_notes": {
"name": "consistency_notes",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"created_by": {
"name": "created_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_canvas_snapshots_project_id_valuation_projects_id_fk": {
"name": "valuation_canvas_snapshots_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_canvas_snapshots",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_canvas_snapshots_created_by_users_id_fk": {
"name": "valuation_canvas_snapshots_created_by_users_id_fk",
"tableFrom": "valuation_canvas_snapshots",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_cap_table": {
"name": "valuation_cap_table",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"shareholder_name": {
"name": "shareholder_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"shareholder_type": {
"name": "shareholder_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"share_class": {
"name": "share_class",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'common'"
},
"shares_owned": {
"name": "shares_owned",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"percentage_owned": {
"name": "percentage_owned",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"investment_amount": {
"name": "investment_amount",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"liquidation_preference": {
"name": "liquidation_preference",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"vesting_schedule": {
"name": "vesting_schedule",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_cap_table_project_id_valuation_projects_id_fk": {
"name": "valuation_cap_table_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_cap_table",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_category_weights": {
"name": "valuation_category_weights",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"segment": {
"name": "segment",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category_code": {
"name": "category_code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"weight": {
"name": "weight",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 10
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_category_weights_tenant_id_tenants_id_fk": {
"name": "valuation_category_weights_tenant_id_tenants_id_fk",
"tableFrom": "valuation_category_weights",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_checklist_attachments": {
"name": "valuation_checklist_attachments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"progress_id": {
"name": "progress_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"filename": {
"name": "filename",
"type": "text",
"primaryKey": false,
"notNull": true
},
"original_name": {
"name": "original_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"mime_type": {
"name": "mime_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"size": {
"name": "size",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"storage_path": {
"name": "storage_path",
"type": "text",
"primaryKey": false,
"notNull": true
},
"uploaded_by": {
"name": "uploaded_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_checklist_attachments_progress_id_valuation_checklist_progress_id_fk": {
"name": "valuation_checklist_attachments_progress_id_valuation_checklist_progress_id_fk",
"tableFrom": "valuation_checklist_attachments",
"tableTo": "valuation_checklist_progress",
"columnsFrom": [
"progress_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_checklist_attachments_uploaded_by_users_id_fk": {
"name": "valuation_checklist_attachments_uploaded_by_users_id_fk",
"tableFrom": "valuation_checklist_attachments",
"tableTo": "users",
"columnsFrom": [
"uploaded_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_checklist_categories": {
"name": "valuation_checklist_categories",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"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
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"segment_filter": {
"name": "segment_filter",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"valuation_checklist_categories_code_unique": {
"name": "valuation_checklist_categories_code_unique",
"nullsNotDistinct": false,
"columns": [
"code"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_checklist_items": {
"name": "valuation_checklist_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"category_id": {
"name": "category_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"code": {
"name": "code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"format": {
"name": "format",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_required": {
"name": "is_required",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"segment_filter": {
"name": "segment_filter",
"type": "text",
"primaryKey": false,
"notNull": false
},
"agent_prompt": {
"name": "agent_prompt",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"valuation_checklist_items_category_id_valuation_checklist_categories_id_fk": {
"name": "valuation_checklist_items_category_id_valuation_checklist_categories_id_fk",
"tableFrom": "valuation_checklist_items",
"tableTo": "valuation_checklist_categories",
"columnsFrom": [
"category_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"valuation_checklist_items_code_unique": {
"name": "valuation_checklist_items_code_unique",
"nullsNotDistinct": false,
"columns": [
"code"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_checklist_progress": {
"name": "valuation_checklist_progress",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"item_id": {
"name": "item_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'pending'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"document_id": {
"name": "document_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"data_json": {
"name": "data_json",
"type": "text",
"primaryKey": false,
"notNull": false
},
"agent_analysis": {
"name": "agent_analysis",
"type": "text",
"primaryKey": false,
"notNull": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"completed_by": {
"name": "completed_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_checklist_progress_project_id_valuation_projects_id_fk": {
"name": "valuation_checklist_progress_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_checklist_progress",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_checklist_progress_item_id_valuation_checklist_items_id_fk": {
"name": "valuation_checklist_progress_item_id_valuation_checklist_items_id_fk",
"tableFrom": "valuation_checklist_progress",
"tableTo": "valuation_checklist_items",
"columnsFrom": [
"item_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_checklist_progress_document_id_valuation_documents_id_fk": {
"name": "valuation_checklist_progress_document_id_valuation_documents_id_fk",
"tableFrom": "valuation_checklist_progress",
"tableTo": "valuation_documents",
"columnsFrom": [
"document_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"valuation_checklist_progress_completed_by_users_id_fk": {
"name": "valuation_checklist_progress_completed_by_users_id_fk",
"tableFrom": "valuation_checklist_progress",
"tableTo": "users",
"columnsFrom": [
"completed_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_document_logs": {
"name": "valuation_document_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"document_id": {
"name": "document_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true
},
"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",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_document_logs_document_id_valuation_documents_id_fk": {
"name": "valuation_document_logs_document_id_valuation_documents_id_fk",
"tableFrom": "valuation_document_logs",
"tableTo": "valuation_documents",
"columnsFrom": [
"document_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_document_logs_user_id_users_id_fk": {
"name": "valuation_document_logs_user_id_users_id_fk",
"tableFrom": "valuation_document_logs",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_documents": {
"name": "valuation_documents",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"transaction_id": {
"name": "transaction_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"folder": {
"name": "folder",
"type": "text",
"primaryKey": false,
"notNull": false
},
"file_url": {
"name": "file_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"file_type": {
"name": "file_type",
"type": "text",
"primaryKey": false,
"notNull": false
},
"file_size": {
"name": "file_size",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"access_level": {
"name": "access_level",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'view_only'"
},
"watermark": {
"name": "watermark",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"uploaded_by": {
"name": "uploaded_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"view_count": {
"name": "view_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"download_count": {
"name": "download_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_documents_project_id_valuation_projects_id_fk": {
"name": "valuation_documents_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_documents",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_documents_transaction_id_valuation_transactions_id_fk": {
"name": "valuation_documents_transaction_id_valuation_transactions_id_fk",
"tableFrom": "valuation_documents",
"tableTo": "valuation_transactions",
"columnsFrom": [
"transaction_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"valuation_documents_uploaded_by_users_id_fk": {
"name": "valuation_documents_uploaded_by_users_id_fk",
"tableFrom": "valuation_documents",
"tableTo": "users",
"columnsFrom": [
"uploaded_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_inputs": {
"name": "valuation_inputs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"is_projection": {
"name": "is_projection",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"revenue": {
"name": "revenue",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"gross_profit": {
"name": "gross_profit",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"ebitda": {
"name": "ebitda",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"ebit": {
"name": "ebit",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"net_income": {
"name": "net_income",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"total_assets": {
"name": "total_assets",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"total_liabilities": {
"name": "total_liabilities",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"total_equity": {
"name": "total_equity",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"cash": {
"name": "cash",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"debt": {
"name": "debt",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"working_capital": {
"name": "working_capital",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"capex": {
"name": "capex",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"depreciation": {
"name": "depreciation",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"free_cash_flow": {
"name": "free_cash_flow",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"arr": {
"name": "arr",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"mrr": {
"name": "mrr",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"churn_rate": {
"name": "churn_rate",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"ltv": {
"name": "ltv",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"cac": {
"name": "cac",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"gmv": {
"name": "gmv",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"tpv": {
"name": "tpv",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"take_rate": {
"name": "take_rate",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"growth_rate": {
"name": "growth_rate",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_inputs_project_id_valuation_projects_id_fk": {
"name": "valuation_inputs_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_inputs",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_maturity_scores": {
"name": "valuation_maturity_scores",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"dimension": {
"name": "dimension",
"type": "text",
"primaryKey": false,
"notNull": true
},
"score": {
"name": "score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"max_score": {
"name": "max_score",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 100
},
"benchmark": {
"name": "benchmark",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"responses": {
"name": "responses",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_maturity_scores_project_id_valuation_projects_id_fk": {
"name": "valuation_maturity_scores_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_maturity_scores",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_projects": {
"name": "valuation_projects",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"tenant_id": {
"name": "tenant_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"company_name": {
"name": "company_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"cnpj": {
"name": "cnpj",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sector": {
"name": "sector",
"type": "text",
"primaryKey": false,
"notNull": true
},
"business_model": {
"name": "business_model",
"type": "text",
"primaryKey": false,
"notNull": false
},
"stage": {
"name": "stage",
"type": "text",
"primaryKey": false,
"notNull": true
},
"size": {
"name": "size",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'draft'"
},
"consultant_id": {
"name": "consultant_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"client_user_id": {
"name": "client_user_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"valuation_range_min": {
"name": "valuation_range_min",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"valuation_range_max": {
"name": "valuation_range_max",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"final_value": {
"name": "final_value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"currency": {
"name": "currency",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'BRL'"
},
"report_url": {
"name": "report_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_projects_tenant_id_tenants_id_fk": {
"name": "valuation_projects_tenant_id_tenants_id_fk",
"tableFrom": "valuation_projects",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_projects_consultant_id_users_id_fk": {
"name": "valuation_projects_consultant_id_users_id_fk",
"tableFrom": "valuation_projects",
"tableTo": "users",
"columnsFrom": [
"consultant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"valuation_projects_client_user_id_users_id_fk": {
"name": "valuation_projects_client_user_id_users_id_fk",
"tableFrom": "valuation_projects",
"tableTo": "users",
"columnsFrom": [
"client_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"valuation_projects_client_id_crm_clients_id_fk": {
"name": "valuation_projects_client_id_crm_clients_id_fk",
"tableFrom": "valuation_projects",
"tableTo": "crm_clients",
"columnsFrom": [
"client_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_sector_benchmarks": {
"name": "valuation_sector_benchmarks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"segment": {
"name": "segment",
"type": "text",
"primaryKey": false,
"notNull": true
},
"indicator_code": {
"name": "indicator_code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"indicator_name": {
"name": "indicator_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"min_value": {
"name": "min_value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"max_value": {
"name": "max_value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"avg_value": {
"name": "avg_value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"top_quartile": {
"name": "top_quartile",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"unit": {
"name": "unit",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_sector_scores": {
"name": "valuation_sector_scores",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"overall_score": {
"name": "overall_score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"category_scores": {
"name": "category_scores",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"indicator_scores": {
"name": "indicator_scores",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"strengths": {
"name": "strengths",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"weaknesses": {
"name": "weaknesses",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"recommendations": {
"name": "recommendations",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"analysis_notes": {
"name": "analysis_notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"calculated_by": {
"name": "calculated_by",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"calculated_at": {
"name": "calculated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"version": {
"name": "version",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_sector_scores_project_id_valuation_projects_id_fk": {
"name": "valuation_sector_scores_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_sector_scores",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"valuation_sector_scores_calculated_by_users_id_fk": {
"name": "valuation_sector_scores_calculated_by_users_id_fk",
"tableFrom": "valuation_sector_scores",
"tableTo": "users",
"columnsFrom": [
"calculated_by"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.valuation_transactions": {
"name": "valuation_transactions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"phase": {
"name": "phase",
"type": "text",
"primaryKey": false,
"notNull": true
},
"target_close_date": {
"name": "target_close_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"actual_close_date": {
"name": "actual_close_date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"deal_value": {
"name": "deal_value",
"type": "numeric",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'active'"
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"valuation_transactions_project_id_valuation_projects_id_fk": {
"name": "valuation_transactions_project_id_valuation_projects_id_fk",
"tableFrom": "valuation_transactions",
"tableTo": "valuation_projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.whatsapp_contacts": {
"name": "whatsapp_contacts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"whatsapp_id": {
"name": "whatsapp_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"push_name": {
"name": "push_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone_number": {
"name": "phone_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"profile_pic_url": {
"name": "profile_pic_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"whatsapp_contacts_user_id_users_id_fk": {
"name": "whatsapp_contacts_user_id_users_id_fk",
"tableFrom": "whatsapp_contacts",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.whatsapp_messages": {
"name": "whatsapp_messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"whatsapp_contact_id": {
"name": "whatsapp_contact_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"remote_jid": {
"name": "remote_jid",
"type": "text",
"primaryKey": false,
"notNull": true
},
"message_id": {
"name": "message_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"from_me": {
"name": "from_me",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'false'"
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": false
},
"message_type": {
"name": "message_type",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'text'"
},
"timestamp": {
"name": "timestamp",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'received'"
},
"quoted_message_id": {
"name": "quoted_message_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"quoted_body": {
"name": "quoted_body",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_deleted": {
"name": "is_deleted",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_edited": {
"name": "is_edited",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"whatsapp_messages_user_id_users_id_fk": {
"name": "whatsapp_messages_user_id_users_id_fk",
"tableFrom": "whatsapp_messages",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"whatsapp_messages_whatsapp_contact_id_whatsapp_contacts_id_fk": {
"name": "whatsapp_messages_whatsapp_contact_id_whatsapp_contacts_id_fk",
"tableFrom": "whatsapp_messages",
"tableTo": "whatsapp_contacts",
"columnsFrom": [
"whatsapp_contact_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.whatsapp_queues": {
"name": "whatsapp_queues",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'#10B981'"
},
"greeting": {
"name": "greeting",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"whatsapp_queues_user_id_users_id_fk": {
"name": "whatsapp_queues_user_id_users_id_fk",
"tableFrom": "whatsapp_queues",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.whatsapp_sessions": {
"name": "whatsapp_sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"session_data": {
"name": "session_data",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'disconnected'"
},
"phone_number": {
"name": "phone_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"last_sync": {
"name": "last_sync",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"whatsapp_sessions_user_id_users_id_fk": {
"name": "whatsapp_sessions_user_id_users_id_fk",
"tableFrom": "whatsapp_sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.whatsapp_tickets": {
"name": "whatsapp_tickets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"owner_id": {
"name": "owner_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"contact_id": {
"name": "contact_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"queue_id": {
"name": "queue_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"assigned_to_id": {
"name": "assigned_to_id",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'open'"
},
"last_message": {
"name": "last_message",
"type": "text",
"primaryKey": false,
"notNull": false
},
"unread_count": {
"name": "unread_count",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"protocol": {
"name": "protocol",
"type": "text",
"primaryKey": false,
"notNull": false
},
"closed_at": {
"name": "closed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"whatsapp_tickets_owner_id_users_id_fk": {
"name": "whatsapp_tickets_owner_id_users_id_fk",
"tableFrom": "whatsapp_tickets",
"tableTo": "users",
"columnsFrom": [
"owner_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"whatsapp_tickets_contact_id_whatsapp_contacts_id_fk": {
"name": "whatsapp_tickets_contact_id_whatsapp_contacts_id_fk",
"tableFrom": "whatsapp_tickets",
"tableTo": "whatsapp_contacts",
"columnsFrom": [
"contact_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"whatsapp_tickets_queue_id_whatsapp_queues_id_fk": {
"name": "whatsapp_tickets_queue_id_whatsapp_queues_id_fk",
"tableFrom": "whatsapp_tickets",
"tableTo": "whatsapp_queues",
"columnsFrom": [
"queue_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"whatsapp_tickets_assigned_to_id_users_id_fk": {
"name": "whatsapp_tickets_assigned_to_id_users_id_fk",
"tableFrom": "whatsapp_tickets",
"tableTo": "users",
"columnsFrom": [
"assigned_to_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.workspace_pages": {
"name": "workspace_pages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"parent_id": {
"name": "parent_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'Sem título'"
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"cover_image": {
"name": "cover_image",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_favorite": {
"name": "is_favorite",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"is_archived": {
"name": "is_archived",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"order_index": {
"name": "order_index",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {
"workspace_pages_user_id_users_id_fk": {
"name": "workspace_pages_user_id_users_id_fk",
"tableFrom": "workspace_pages",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}