{
  "id": "0c92a766-9dd3-42e3-841c-5fb89b6a0204",
  "prevId": "bfcdd51a-05fe-4f09-984b-6205467e4184",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.activity_logs": {
      "name": "activity_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "entity_label": {
          "name": "entity_label",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "changes": {
          "name": "changes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "activity_project_created_idx": {
          "name": "activity_project_created_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "activity_entity_idx": {
          "name": "activity_entity_idx",
          "columns": [
            {
              "expression": "entity_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "entity_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "activity_logs_project_id_projects_id_fk": {
          "name": "activity_logs_project_id_projects_id_fk",
          "tableFrom": "activity_logs",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "activity_logs_user_id_users_id_fk": {
          "name": "activity_logs_user_id_users_id_fk",
          "tableFrom": "activity_logs",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.component_members": {
      "name": "component_members",
      "schema": "",
      "columns": {
        "component_id": {
          "name": "component_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "component_members_component_id_components_id_fk": {
          "name": "component_members_component_id_components_id_fk",
          "tableFrom": "component_members",
          "tableTo": "components",
          "columnsFrom": [
            "component_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "component_members_user_id_users_id_fk": {
          "name": "component_members_user_id_users_id_fk",
          "tableFrom": "component_members",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "component_members_component_id_user_id_pk": {
          "name": "component_members_component_id_user_id_pk",
          "columns": [
            "component_id",
            "user_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.components": {
      "name": "components",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "system_id": {
          "name": "system_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "subsystem": {
          "name": "subsystem",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "quantity": {
          "name": "quantity",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "responsible_id": {
          "name": "responsible_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'medium'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'idea'"
        },
        "start_date": {
          "name": "start_date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "due_date": {
          "name": "due_date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "material": {
          "name": "material",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "material_qty": {
          "name": "material_qty",
          "type": "numeric(12, 3)",
          "primaryKey": false,
          "notNull": false
        },
        "material_unit": {
          "name": "material_unit",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "supplier": {
          "name": "supplier",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "material_status": {
          "name": "material_status",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "designer_id": {
          "name": "designer_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "design_approved_at": {
          "name": "design_approved_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "design_notes": {
          "name": "design_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "est_material_cost": {
          "name": "est_material_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "est_manufacturing_cost": {
          "name": "est_manufacturing_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "est_shipping_cost": {
          "name": "est_shipping_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "est_additional_cost": {
          "name": "est_additional_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "actual_cost": {
          "name": "actual_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "components_project_code_idx": {
          "name": "components_project_code_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "components_system_idx": {
          "name": "components_system_idx",
          "columns": [
            {
              "expression": "system_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "components_responsible_idx": {
          "name": "components_responsible_idx",
          "columns": [
            {
              "expression": "responsible_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "components_status_idx": {
          "name": "components_status_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "components_project_id_projects_id_fk": {
          "name": "components_project_id_projects_id_fk",
          "tableFrom": "components",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "components_system_id_systems_id_fk": {
          "name": "components_system_id_systems_id_fk",
          "tableFrom": "components",
          "tableTo": "systems",
          "columnsFrom": [
            "system_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "restrict",
          "onUpdate": "no action"
        },
        "components_responsible_id_users_id_fk": {
          "name": "components_responsible_id_users_id_fk",
          "tableFrom": "components",
          "tableTo": "users",
          "columnsFrom": [
            "responsible_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "components_designer_id_users_id_fk": {
          "name": "components_designer_id_users_id_fk",
          "tableFrom": "components",
          "tableTo": "users",
          "columnsFrom": [
            "designer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "components_created_by_users_id_fk": {
          "name": "components_created_by_users_id_fk",
          "tableFrom": "components",
          "tableTo": "users",
          "columnsFrom": [
            "created_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.dependencies": {
      "name": "dependencies",
      "schema": "",
      "columns": {
        "component_id": {
          "name": "component_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "depends_on_id": {
          "name": "depends_on_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "dependencies_depends_on_idx": {
          "name": "dependencies_depends_on_idx",
          "columns": [
            {
              "expression": "depends_on_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "dependencies_component_id_components_id_fk": {
          "name": "dependencies_component_id_components_id_fk",
          "tableFrom": "dependencies",
          "tableTo": "components",
          "columnsFrom": [
            "component_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "dependencies_depends_on_id_components_id_fk": {
          "name": "dependencies_depends_on_id_components_id_fk",
          "tableFrom": "dependencies",
          "tableTo": "components",
          "columnsFrom": [
            "depends_on_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "dependencies_component_id_depends_on_id_pk": {
          "name": "dependencies_component_id_depends_on_id_pk",
          "columns": [
            "component_id",
            "depends_on_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {
        "dependencies_no_self": {
          "name": "dependencies_no_self",
          "value": "\"dependencies\".\"component_id\" <> \"dependencies\".\"depends_on_id\""
        }
      },
      "isRLSEnabled": false
    },
    "public.files": {
      "name": "files",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'other'"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "storage_key": {
          "name": "storage_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "mime": {
          "name": "mime",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "size": {
          "name": "size",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "uploaded_by": {
          "name": "uploaded_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "files_entity_idx": {
          "name": "files_entity_idx",
          "columns": [
            {
              "expression": "entity_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "entity_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "files_project_id_projects_id_fk": {
          "name": "files_project_id_projects_id_fk",
          "tableFrom": "files",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "files_uploaded_by_users_id_fk": {
          "name": "files_uploaded_by_users_id_fk",
          "tableFrom": "files",
          "tableTo": "users",
          "columnsFrom": [
            "uploaded_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.inspections": {
      "name": "inspections",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "component_id": {
          "name": "component_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "inspector_id": {
          "name": "inspector_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "result": {
          "name": "result",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "observations": {
          "name": "observations",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "inspections_component_id_components_id_fk": {
          "name": "inspections_component_id_components_id_fk",
          "tableFrom": "inspections",
          "tableTo": "components",
          "columnsFrom": [
            "component_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "inspections_inspector_id_users_id_fk": {
          "name": "inspections_inspector_id_users_id_fk",
          "tableFrom": "inspections",
          "tableTo": "users",
          "columnsFrom": [
            "inspector_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.manufacturing": {
      "name": "manufacturing",
      "schema": "",
      "columns": {
        "component_id": {
          "name": "component_id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true
        },
        "process": {
          "name": "process",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "machine": {
          "name": "machine",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "workshop": {
          "name": "workshop",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "setup_minutes": {
          "name": "setup_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "machine_minutes": {
          "name": "machine_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "finishing_minutes": {
          "name": "finishing_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "inspection_minutes": {
          "name": "inspection_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "responsible_id": {
          "name": "responsible_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "scheduled_date": {
          "name": "scheduled_date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "actual_date": {
          "name": "actual_date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "needs_workshop": {
          "name": "needs_workshop",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "needs_external": {
          "name": "needs_external",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "manufacturing_component_id_components_id_fk": {
          "name": "manufacturing_component_id_components_id_fk",
          "tableFrom": "manufacturing",
          "tableTo": "components",
          "columnsFrom": [
            "component_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "manufacturing_responsible_id_users_id_fk": {
          "name": "manufacturing_responsible_id_users_id_fk",
          "tableFrom": "manufacturing",
          "tableTo": "users",
          "columnsFrom": [
            "responsible_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.milestones": {
      "name": "milestones",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "completed_at": {
          "name": "completed_at",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "milestones_project_idx": {
          "name": "milestones_project_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "milestones_project_id_projects_id_fk": {
          "name": "milestones_project_id_projects_id_fk",
          "tableFrom": "milestones",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.project_members": {
      "name": "project_members",
      "schema": "",
      "columns": {
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'member'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "project_members_project_id_projects_id_fk": {
          "name": "project_members_project_id_projects_id_fk",
          "tableFrom": "project_members",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "project_members_user_id_users_id_fk": {
          "name": "project_members_user_id_users_id_fk",
          "tableFrom": "project_members",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "project_members_project_id_user_id_pk": {
          "name": "project_members_project_id_user_id_pk",
          "columns": [
            "project_id",
            "user_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.projects": {
      "name": "projects",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "competition": {
          "name": "competition",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'planning'"
        },
        "start_date": {
          "name": "start_date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "target_date": {
          "name": "target_date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "budget": {
          "name": "budget",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'CRC'"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "projects_created_by_users_id_fk": {
          "name": "projects_created_by_users_id_fk",
          "tableFrom": "projects",
          "tableTo": "users",
          "columnsFrom": [
            "created_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.purchase_components": {
      "name": "purchase_components",
      "schema": "",
      "columns": {
        "purchase_id": {
          "name": "purchase_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "component_id": {
          "name": "component_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "purchase_components_purchase_id_purchases_id_fk": {
          "name": "purchase_components_purchase_id_purchases_id_fk",
          "tableFrom": "purchase_components",
          "tableTo": "purchases",
          "columnsFrom": [
            "purchase_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "purchase_components_component_id_components_id_fk": {
          "name": "purchase_components_component_id_components_id_fk",
          "tableFrom": "purchase_components",
          "tableTo": "components",
          "columnsFrom": [
            "component_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "purchase_components_purchase_id_component_id_pk": {
          "name": "purchase_components_purchase_id_component_id_pk",
          "columns": [
            "purchase_id",
            "component_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.purchases": {
      "name": "purchases",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "quantity": {
          "name": "quantity",
          "type": "numeric(12, 3)",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "unit_cost": {
          "name": "unit_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "shipping_cost": {
          "name": "shipping_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "additional_cost": {
          "name": "additional_cost",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "supplier": {
          "name": "supplier",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'to_buy'"
        },
        "lead_time_days": {
          "name": "lead_time_days",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "ordered_at": {
          "name": "ordered_at",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "expected_at": {
          "name": "expected_at",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "received_at": {
          "name": "received_at",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "requested_by": {
          "name": "requested_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "purchases_project_idx": {
          "name": "purchases_project_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "purchases_project_id_projects_id_fk": {
          "name": "purchases_project_id_projects_id_fk",
          "tableFrom": "purchases",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "purchases_requested_by_users_id_fk": {
          "name": "purchases_requested_by_users_id_fk",
          "tableFrom": "purchases",
          "tableTo": "users",
          "columnsFrom": [
            "requested_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sessions": {
      "name": "sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "sessions_user_id_users_id_fk": {
          "name": "sessions_user_id_users_id_fk",
          "tableFrom": "sessions",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.system_members": {
      "name": "system_members",
      "schema": "",
      "columns": {
        "system_id": {
          "name": "system_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'member'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "system_members_system_id_systems_id_fk": {
          "name": "system_members_system_id_systems_id_fk",
          "tableFrom": "system_members",
          "tableTo": "systems",
          "columnsFrom": [
            "system_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "system_members_user_id_users_id_fk": {
          "name": "system_members_user_id_users_id_fk",
          "tableFrom": "system_members",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "system_members_system_id_user_id_pk": {
          "name": "system_members_system_id_user_id_pk",
          "columns": [
            "system_id",
            "user_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.systems": {
      "name": "systems",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "budget": {
          "name": "budget",
          "type": "numeric(14, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "systems_project_code_idx": {
          "name": "systems_project_code_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "systems_project_id_projects_id_fk": {
          "name": "systems_project_id_projects_id_fk",
          "tableFrom": "systems",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tests": {
      "name": "tests",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "system_id": {
          "name": "system_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "component_id": {
          "name": "component_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": false
        },
        "responsible_id": {
          "name": "responsible_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "objective": {
          "name": "objective",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "result": {
          "name": "result",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'planned'"
        },
        "observations": {
          "name": "observations",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "tests_project_idx": {
          "name": "tests_project_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "tests_project_id_projects_id_fk": {
          "name": "tests_project_id_projects_id_fk",
          "tableFrom": "tests",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "tests_system_id_systems_id_fk": {
          "name": "tests_system_id_systems_id_fk",
          "tableFrom": "tests",
          "tableTo": "systems",
          "columnsFrom": [
            "system_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "tests_component_id_components_id_fk": {
          "name": "tests_component_id_components_id_fk",
          "tableFrom": "tests",
          "tableTo": "components",
          "columnsFrom": [
            "component_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "tests_responsible_id_users_id_fk": {
          "name": "tests_responsible_id_users_id_fk",
          "tableFrom": "tests",
          "tableTo": "users",
          "columnsFrom": [
            "responsible_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "avatar_url": {
          "name": "avatar_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'member'"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "users_email_unique": {
          "name": "users_email_unique",
          "nullsNotDistinct": false,
          "columns": [
            "email"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.work_logs": {
      "name": "work_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "project_id": {
          "name": "project_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "component_id": {
          "name": "component_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "minutes": {
          "name": "minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "progress": {
          "name": "progress",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "pending": {
          "name": "pending",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "work_logs_project_date_idx": {
          "name": "work_logs_project_date_idx",
          "columns": [
            {
              "expression": "project_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "work_logs_user_idx": {
          "name": "work_logs_user_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "work_logs_project_id_projects_id_fk": {
          "name": "work_logs_project_id_projects_id_fk",
          "tableFrom": "work_logs",
          "tableTo": "projects",
          "columnsFrom": [
            "project_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "work_logs_user_id_users_id_fk": {
          "name": "work_logs_user_id_users_id_fk",
          "tableFrom": "work_logs",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "work_logs_component_id_components_id_fk": {
          "name": "work_logs_component_id_components_id_fk",
          "tableFrom": "work_logs",
          "tableTo": "components",
          "columnsFrom": [
            "component_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {
        "work_logs_minutes_positive": {
          "name": "work_logs_minutes_positive",
          "value": "\"work_logs\".\"minutes\" > 0"
        }
      },
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}