{
  "id": "22d64fbd-9e5e-4543-a0d0-7c068e0c998b",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.approvals": {
      "name": "approvals",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "reference_id": {
          "name": "reference_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "requested_by": {
          "name": "requested_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'مدیر ناوگان'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "supervisor_note": {
          "name": "supervisor_note",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "resolved_at": {
          "name": "resolved_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_approvals_status": {
          "name": "idx_approvals_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.assignments": {
      "name": "assignments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "vehicle_id": {
          "name": "vehicle_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "driver_id": {
          "name": "driver_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "start_at": {
          "name": "start_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "expected_return_at": {
          "name": "expected_return_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "end_at": {
          "name": "end_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "assignment_type": {
          "name": "assignment_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'long_term'"
        },
        "purpose": {
          "name": "purpose",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "destination": {
          "name": "destination",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "start_mileage": {
          "name": "start_mileage",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "end_mileage": {
          "name": "end_mileage",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "return_requested_at": {
          "name": "return_requested_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "returned_approved_at": {
          "name": "returned_approved_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_assignments_vehicle_status": {
          "name": "idx_assignments_vehicle_status",
          "columns": [
            {
              "expression": "vehicle_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_assignments_driver_status": {
          "name": "idx_assignments_driver_status",
          "columns": [
            {
              "expression": "driver_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "assignments_vehicle_id_vehicles_id_fk": {
          "name": "assignments_vehicle_id_vehicles_id_fk",
          "tableFrom": "assignments",
          "tableTo": "vehicles",
          "columnsFrom": [
            "vehicle_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "assignments_driver_id_drivers_id_fk": {
          "name": "assignments_driver_id_drivers_id_fk",
          "tableFrom": "assignments",
          "tableTo": "drivers",
          "columnsFrom": [
            "driver_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.drivers": {
      "name": "drivers",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "full_name": {
          "name": "full_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "national_id": {
          "name": "national_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "license_no": {
          "name": "license_no",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "license_expiry": {
          "name": "license_expiry",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_drivers_status": {
          "name": "idx_drivers_status",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "drivers_national_id_unique": {
          "name": "drivers_national_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "national_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.inspection_items": {
      "name": "inspection_items",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "inspection_id": {
          "name": "inspection_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "group_key": {
          "name": "group_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "item_key": {
          "name": "item_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        }
      },
      "indexes": {
        "idx_inspection_items_inspection": {
          "name": "idx_inspection_items_inspection",
          "columns": [
            {
              "expression": "inspection_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "inspection_items_inspection_id_inspections_id_fk": {
          "name": "inspection_items_inspection_id_inspections_id_fk",
          "tableFrom": "inspection_items",
          "tableTo": "inspections",
          "columnsFrom": [
            "inspection_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.inspection_photos": {
      "name": "inspection_photos",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "inspection_id": {
          "name": "inspection_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_path": {
          "name": "file_path",
          "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_bytes": {
          "name": "size_bytes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_inspection_photos_inspection": {
          "name": "idx_inspection_photos_inspection",
          "columns": [
            {
              "expression": "inspection_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "inspection_photos_inspection_id_inspections_id_fk": {
          "name": "inspection_photos_inspection_id_inspections_id_fk",
          "tableFrom": "inspection_photos",
          "tableTo": "inspections",
          "columnsFrom": [
            "inspection_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.inspections": {
      "name": "inspections",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "vehicle_id": {
          "name": "vehicle_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "driver_id": {
          "name": "driver_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "assignment_id": {
          "name": "assignment_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "inspector_user_id": {
          "name": "inspector_user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "inspector_name": {
          "name": "inspector_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "inspected_at": {
          "name": "inspected_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "odometer": {
          "name": "odometer",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "technical_certificate_valid": {
          "name": "technical_certificate_valid",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true
        },
        "driver_license_valid": {
          "name": "driver_license_valid",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true
        },
        "supervisor_status": {
          "name": "supervisor_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'approved'"
        },
        "manager_status": {
          "name": "manager_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "manager_note": {
          "name": "manager_note",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "next_due_at": {
          "name": "next_due_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_inspections_vehicle_date": {
          "name": "idx_inspections_vehicle_date",
          "columns": [
            {
              "expression": "vehicle_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "inspected_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_inspections_manager_status": {
          "name": "idx_inspections_manager_status",
          "columns": [
            {
              "expression": "manager_status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "inspections_vehicle_id_vehicles_id_fk": {
          "name": "inspections_vehicle_id_vehicles_id_fk",
          "tableFrom": "inspections",
          "tableTo": "vehicles",
          "columnsFrom": [
            "vehicle_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "inspections_driver_id_drivers_id_fk": {
          "name": "inspections_driver_id_drivers_id_fk",
          "tableFrom": "inspections",
          "tableTo": "drivers",
          "columnsFrom": [
            "driver_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "inspections_assignment_id_assignments_id_fk": {
          "name": "inspections_assignment_id_assignments_id_fk",
          "tableFrom": "inspections",
          "tableTo": "assignments",
          "columnsFrom": [
            "assignment_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "inspections_code_unique": {
          "name": "inspections_code_unique",
          "nullsNotDistinct": false,
          "columns": [
            "code"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.maintenance": {
      "name": "maintenance",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "vehicle_id": {
          "name": "vehicle_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "due_date": {
          "name": "due_date",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "due_mileage": {
          "name": "due_mileage",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "cost": {
          "name": "cost",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "vendor": {
          "name": "vendor",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'scheduled'"
        },
        "completed_at": {
          "name": "completed_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_maintenance_vehicle_status": {
          "name": "idx_maintenance_vehicle_status",
          "columns": [
            {
              "expression": "vehicle_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_maintenance_due_date": {
          "name": "idx_maintenance_due_date",
          "columns": [
            {
              "expression": "due_date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "maintenance_vehicle_id_vehicles_id_fk": {
          "name": "maintenance_vehicle_id_vehicles_id_fk",
          "tableFrom": "maintenance",
          "tableTo": "vehicles",
          "columnsFrom": [
            "vehicle_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sessions": {
      "name": "sessions",
      "schema": "",
      "columns": {
        "token_hash": {
          "name": "token_hash",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_sessions_user_id": {
          "name": "idx_sessions_user_id",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_sessions_expires_at": {
          "name": "idx_sessions_expires_at",
          "columns": [
            {
              "expression": "expires_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "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.sms_logs": {
      "name": "sms_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "event": {
          "name": "event",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "receptor": {
          "name": "receptor",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "template": {
          "name": "template",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "token": {
          "name": "token",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'unconfigured'"
        },
        "provider_message_id": {
          "name": "provider_message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "response_message": {
          "name": "response_message",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_sms_logs_status_created": {
          "name": "idx_sms_logs_status_created",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ticket_messages": {
      "name": "ticket_messages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "ticket_id": {
          "name": "ticket_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "author": {
          "name": "author",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "author_role": {
          "name": "author_role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'management'"
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_ticket_messages_ticket_id": {
          "name": "idx_ticket_messages_ticket_id",
          "columns": [
            {
              "expression": "ticket_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "ticket_messages_ticket_id_tickets_id_fk": {
          "name": "ticket_messages_ticket_id_tickets_id_fk",
          "tableFrom": "ticket_messages",
          "tableTo": "tickets",
          "columnsFrom": [
            "ticket_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tickets": {
      "name": "tickets",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'general'"
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'normal'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'open'"
        },
        "vehicle_id": {
          "name": "vehicle_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "driver_id": {
          "name": "driver_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "assignment_id": {
          "name": "assignment_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "reporter": {
          "name": "reporter",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'مدیر ناوگان'"
        },
        "assignee": {
          "name": "assignee",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'سوپروایزر'"
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "closed_at": {
          "name": "closed_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_tickets_status_priority": {
          "name": "idx_tickets_status_priority",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "priority",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_tickets_vehicle_id": {
          "name": "idx_tickets_vehicle_id",
          "columns": [
            {
              "expression": "vehicle_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "tickets_vehicle_id_vehicles_id_fk": {
          "name": "tickets_vehicle_id_vehicles_id_fk",
          "tableFrom": "tickets",
          "tableTo": "vehicles",
          "columnsFrom": [
            "vehicle_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "tickets_driver_id_drivers_id_fk": {
          "name": "tickets_driver_id_drivers_id_fk",
          "tableFrom": "tickets",
          "tableTo": "drivers",
          "columnsFrom": [
            "driver_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "tickets_assignment_id_assignments_id_fk": {
          "name": "tickets_assignment_id_assignments_id_fk",
          "tableFrom": "tickets",
          "tableTo": "assignments",
          "columnsFrom": [
            "assignment_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "tickets_code_unique": {
          "name": "tickets_code_unique",
          "nullsNotDistinct": false,
          "columns": [
            "code"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "username": {
          "name": "username",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "full_name": {
          "name": "full_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "driver_id": {
          "name": "driver_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "must_change_password": {
          "name": "must_change_password",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_users_role_active": {
          "name": "idx_users_role_active",
          "columns": [
            {
              "expression": "role",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "is_active",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "users_driver_id_drivers_id_fk": {
          "name": "users_driver_id_drivers_id_fk",
          "tableFrom": "users",
          "tableTo": "drivers",
          "columnsFrom": [
            "driver_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "users_username_unique": {
          "name": "users_username_unique",
          "nullsNotDistinct": false,
          "columns": [
            "username"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.vehicle_requests": {
      "name": "vehicle_requests",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "vehicle_id": {
          "name": "vehicle_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "driver_id": {
          "name": "driver_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "purpose": {
          "name": "purpose",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "destination": {
          "name": "destination",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "requested_at": {
          "name": "requested_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "supervisor_note": {
          "name": "supervisor_note",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "resolved_at": {
          "name": "resolved_at",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "idx_vehicle_requests_driver_status": {
          "name": "idx_vehicle_requests_driver_status",
          "columns": [
            {
              "expression": "driver_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_vehicle_requests_vehicle_status": {
          "name": "idx_vehicle_requests_vehicle_status",
          "columns": [
            {
              "expression": "vehicle_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "vehicle_requests_vehicle_id_vehicles_id_fk": {
          "name": "vehicle_requests_vehicle_id_vehicles_id_fk",
          "tableFrom": "vehicle_requests",
          "tableTo": "vehicles",
          "columnsFrom": [
            "vehicle_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "vehicle_requests_driver_id_drivers_id_fk": {
          "name": "vehicle_requests_driver_id_drivers_id_fk",
          "tableFrom": "vehicle_requests",
          "tableTo": "drivers",
          "columnsFrom": [
            "driver_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.vehicle_types": {
      "name": "vehicle_types",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "brand": {
          "name": "brand",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'سواری'"
        },
        "image_url": {
          "name": "image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_vehicle_types_active": {
          "name": "idx_vehicle_types_active",
          "columns": [
            {
              "expression": "is_active",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.vehicles": {
      "name": "vehicles",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "type_id": {
          "name": "type_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "plate": {
          "name": "plate",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "vin": {
          "name": "vin",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "year": {
          "name": "year",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "color": {
          "name": "color",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "mileage": {
          "name": "mileage",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'ready'"
        },
        "inspection_interval_days": {
          "name": "inspection_interval_days",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 30
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "CURRENT_TIMESTAMP::text"
        }
      },
      "indexes": {
        "idx_vehicles_status": {
          "name": "idx_vehicles_status",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "vehicles_type_id_vehicle_types_id_fk": {
          "name": "vehicles_type_id_vehicle_types_id_fk",
          "tableFrom": "vehicles",
          "tableTo": "vehicle_types",
          "columnsFrom": [
            "type_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "vehicles_plate_unique": {
          "name": "vehicles_plate_unique",
          "nullsNotDistinct": false,
          "columns": [
            "plate"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}
