{
"id": "75e3ee02-94c9-4ead-bb4b-ae9a506acb34",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.areas": {
"name": "areas",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"type": {
"name": "type",
"type": "varchar(250)",
"primaryKey": false,
"notNull": true
},
"length": {
"name": "length",
"type": "real",
"primaryKey": false,
"notNull": true
},
"width": {
"name": "width",
"type": "real",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 1
},
"project_id": {
"name": "project_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"project_name": {
"name": "project_name",
"type": "varchar(250)",
"primaryKey": false,
"notNull": true
},
"floorId": {
"name": "floorId",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'no iniciada'"
}
},
"indexes": {
"areas_floor": {
"name": "areas_floor",
"columns": [
{
"expression": "floorId",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"areas_project_id_project_id_fk": {
"name": "areas_project_id_project_id_fk",
"tableFrom": "areas",
"tableTo": "project",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"areas_floorId_floor_id_fk": {
"name": "areas_floorId_floor_id_fk",
"tableFrom": "areas",
"tableTo": "floor",
"columnsFrom": [
"floorId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.eventsLog": {
"name": "eventsLog",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"eventType": {
"name": "eventType",
"type": "eventType",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"userId": {
"name": "userId",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"newValues": {
"name": "newValues",
"type": "text",
"primaryKey": false,
"notNull": true
},
"modifiedItem": {
"name": "modifiedItem",
"type": "text",
"primaryKey": false,
"notNull": true
},
"tableName": {
"name": "tableName",
"type": "varchar(80)",
"primaryKey": false,
"notNull": true
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"eventsLog_userId_user_id_fk": {
"name": "eventsLog_userId_user_id_fk",
"tableFrom": "eventsLog",
"tableTo": "user",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.floor": {
"name": "floor",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"project_name": {
"name": "project_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"floor_project": {
"name": "floor_project",
"columns": [
{
"expression": "project_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"floor_project_id_project_id_fk": {
"name": "floor_project_id_project_id_fk",
"tableFrom": "floor",
"tableTo": "project",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"floor_name_project_id_unique": {
"name": "floor_name_project_id_unique",
"nullsNotDistinct": false,
"columns": [
"name",
"project_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.materials": {
"name": "materials",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(250)",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"brand": {
"name": "brand",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"materials_name_unique": {
"name": "materials_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.project": {
"name": "project",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(250)",
"primaryKey": false,
"notNull": true
},
"residence": {
"name": "residence",
"type": "type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"costPerMeter": {
"name": "costPerMeter",
"type": "bigint",
"primaryKey": false,
"notNull": true,
"default": 0
},
"totalCostPerMeter": {
"name": "totalCostPerMeter",
"type": "bigint",
"primaryKey": false,
"notNull": false,
"default": 0
},
"totalCostMaterials": {
"name": "totalCostMaterials",
"type": "bigint",
"primaryKey": false,
"notNull": false,
"default": 0
},
"laborCost": {
"name": "laborCost",
"type": "bigint",
"primaryKey": false,
"notNull": true,
"default": 0
},
"startDate": {
"name": "startDate",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"typeCotization": {
"name": "typeCotization",
"type": "typeCotization",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"estimadedEndDate": {
"name": "estimadedEndDate",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"status": {
"name": "status",
"type": "status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'no iniciada'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {
"project_name": {
"name": "project_name",
"columns": [
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"startDate": {
"name": "startDate",
"columns": [
{
"expression": "startDate",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"project_status": {
"name": "project_status",
"columns": [
{
"expression": "status",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.task": {
"name": "task",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true
},
"comments": {
"name": "comments",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'no iniciada'"
},
"user_id": {
"name": "user_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"start_date": {
"name": "start_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"expire_date": {
"name": "expire_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"started_time": {
"name": "started_time",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"ended_time": {
"name": "ended_time",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"project_id": {
"name": "project_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"area_id": {
"name": "area_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"area_name": {
"name": "area_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"floor_name": {
"name": "floor_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"project_name": {
"name": "project_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"priority": {
"name": "priority",
"type": "priority",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"created_At": {
"name": "created_At",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
},
"updated_At": {
"name": "updated_At",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {
"task_project": {
"name": "task_project",
"columns": [
{
"expression": "project_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"task_area": {
"name": "task_area",
"columns": [
{
"expression": "area_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"task_startDate": {
"name": "task_startDate",
"columns": [
{
"expression": "start_date",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"task_endDate": {
"name": "task_endDate",
"columns": [
{
"expression": "expire_date",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"task_status": {
"name": "task_status",
"columns": [
{
"expression": "status",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"task_user": {
"name": "task_user",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"task_user_id_user_id_fk": {
"name": "task_user_id_user_id_fk",
"tableFrom": "task",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
},
"task_project_id_project_id_fk": {
"name": "task_project_id_project_id_fk",
"tableFrom": "task",
"tableTo": "project",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
},
"task_area_id_areas_id_fk": {
"name": "task_area_id_areas_id_fk",
"tableFrom": "task",
"tableTo": "areas",
"columnsFrom": [
"area_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar(255)",
"primaryKey": true,
"notNull": true
},
"firstName": {
"name": "firstName",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"lastName": {
"name": "lastName",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"rol": {
"name": "rol",
"type": "userRols",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'moderator'"
},
"is_deleted": {
"name": "is_deleted",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"user_email_unique": {
"name": "user_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.projectMaterials": {
"name": "projectMaterials",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"project_name": {
"name": "project_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"project_id": {
"name": "project_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"material_id": {
"name": "material_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"required_quantity": {
"name": "required_quantity",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"used_quantity": {
"name": "used_quantity",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"available_quantity": {
"name": "available_quantity",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {
"projectMaterials_project": {
"name": "projectMaterials_project",
"columns": [
{
"expression": "project_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"material_id": {
"name": "material_id",
"columns": [
{
"expression": "material_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"projectMaterials_project_id_project_id_fk": {
"name": "projectMaterials_project_id_project_id_fk",
"tableFrom": "projectMaterials",
"tableTo": "project",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
},
"projectMaterials_material_id_materials_id_fk": {
"name": "projectMaterials_material_id_materials_id_fk",
"tableFrom": "projectMaterials",
"tableTo": "materials",
"columnsFrom": [
"material_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"projectMaterials_material_id_project_id_unique": {
"name": "projectMaterials_material_id_project_id_unique",
"nullsNotDistinct": false,
"columns": [
"material_id",
"project_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tool": {
"name": "tool",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 1
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.userTool": {
"name": "userTool",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true
},
"toolId": {
"name": "toolId",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"userId": {
"name": "userId",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"tool_name": {
"name": "tool_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 1
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"userTool_tool": {
"name": "userTool_tool",
"columns": [
{
"expression": "toolId",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"userTool_user": {
"name": "userTool_user",
"columns": [
{
"expression": "userId",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"userTool_toolId_tool_id_fk": {
"name": "userTool_toolId_tool_id_fk",
"tableFrom": "userTool",
"tableTo": "tool",
"columnsFrom": [
"toolId"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
},
"userTool_userId_user_id_fk": {
"name": "userTool_userId_user_id_fk",
"tableFrom": "userTool",
"tableTo": "user",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"userTool_toolId_userId_unique": {
"name": "userTool_toolId_userId_unique",
"nullsNotDistinct": false,
"columns": [
"toolId",
"userId"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.status": {
"name": "status",
"schema": "public",
"values": [
"no iniciada",
"en proceso",
"completada",
"revisada",
"cancelada",
"reabierta"
]
},
"public.eventType": {
"name": "eventType",
"schema": "public",
"values": [
"crear",
"modificar",
"eliminar"
]
},
"public.type": {
"name": "type",
"schema": "public",
"values": [
"apartamento",
"casa",
"otro"
]
},
"public.typeCotization": {
"name": "typeCotization",
"schema": "public",
"values": [
"pa",
"metro",
"otro"
]
},
"public.priority": {
"name": "priority",
"schema": "public",
"values": [
"baja",
"media",
"alta"
]
},
"public.userRols": {
"name": "userRols",
"schema": "public",
"values": [
"admin",
"moderator",
"user"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}