{
  "id": "2e1b3c0d-b7bb-4f29-a390-80eb06881eab",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "coder.agent": {
      "name": "agent",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "repo": {
          "name": "repo",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "path": {
          "name": "path",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "current_version": {
          "name": "current_version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "settings": {
          "name": "settings",
          "type": "jsonb",
          "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": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "agent_organizationId_slug_unique": {
          "name": "agent_organizationId_slug_unique",
          "nullsNotDistinct": false,
          "columns": [
            "organization_id",
            "slug"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.agent_version": {
      "name": "agent_version",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "agent_id": {
          "name": "agent_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "definition": {
          "name": "definition",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "system_prompt": {
          "name": "system_prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "files": {
          "name": "files",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "commit": {
          "name": "commit",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "imported_from": {
          "name": "imported_from",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "agent_version_agent_id_agent_id_fk": {
          "name": "agent_version_agent_id_agent_id_fk",
          "tableFrom": "agent_version",
          "tableTo": "agent",
          "schemaTo": "coder",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "agent_version_agentId_version_unique": {
          "name": "agent_version_agentId_version_unique",
          "nullsNotDistinct": false,
          "columns": [
            "agent_id",
            "version"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.chat_item": {
      "name": "chat_item",
      "schema": "coder",
      "columns": {
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "seq": {
          "name": "seq",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "identity": {
            "type": "always",
            "name": "chat_item_seq_seq",
            "schema": "coder",
            "increment": "1",
            "startWith": "1",
            "minValue": "1",
            "maxValue": "9223372036854775807",
            "cache": "1",
            "cycle": false
          }
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "chat_item_expires_at_index": {
          "name": "chat_item_expires_at_index",
          "columns": [
            {
              "expression": "expires_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "where": "\"coder\".\"chat_item\".\"expires_at\" is not null",
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "chat_item_key_seq_pk": {
          "name": "chat_item_key_seq_pk",
          "columns": [
            "key",
            "seq"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.chat_state": {
      "name": "chat_state",
      "schema": "coder",
      "columns": {
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "chat_state_expires_at_index": {
          "name": "chat_state_expires_at_index",
          "columns": [
            {
              "expression": "expires_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "where": "\"coder\".\"chat_state\".\"expires_at\" is not null",
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.engine_credential": {
      "name": "engine_credential",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "secret_id": {
          "name": "secret_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "owner": {
          "name": "owner",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "engine": {
          "name": "engine",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "account": {
          "name": "account",
          "type": "jsonb",
          "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": {
        "engine_credential_secret_id_secret_id_fk": {
          "name": "engine_credential_secret_id_secret_id_fk",
          "tableFrom": "engine_credential",
          "tableTo": "secret",
          "schemaTo": "coder",
          "columnsFrom": [
            "secret_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "engine_credential_secretId_unique": {
          "name": "engine_credential_secretId_unique",
          "nullsNotDistinct": false,
          "columns": [
            "secret_id"
          ]
        },
        "engine_credential_organizationId_owner_label_unique": {
          "name": "engine_credential_organizationId_owner_label_unique",
          "nullsNotDistinct": true,
          "columns": [
            "organization_id",
            "owner",
            "label"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.integration_app": {
      "name": "integration_app",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "integration": {
          "name": "integration",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "platform_app_id": {
          "name": "platform_app_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "agent": {
          "name": "agent",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "agents_repo": {
          "name": "agents_repo",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "branch": {
          "name": "branch",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "credentials_secret_id": {
          "name": "credentials_secret_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "integration_app_credentials_secret_id_secret_id_fk": {
          "name": "integration_app_credentials_secret_id_secret_id_fk",
          "tableFrom": "integration_app",
          "tableTo": "secret",
          "schemaTo": "coder",
          "columnsFrom": [
            "credentials_secret_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "integration_app_organizationId_key_unique": {
          "name": "integration_app_organizationId_key_unique",
          "nullsNotDistinct": false,
          "columns": [
            "organization_id",
            "key"
          ]
        },
        "integration_app_integration_platformAppId_unique": {
          "name": "integration_app_integration_platformAppId_unique",
          "nullsNotDistinct": false,
          "columns": [
            "integration",
            "platform_app_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.integration_app_installation": {
      "name": "integration_app_installation",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "app_id": {
          "name": "app_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "platform_install_id": {
          "name": "platform_install_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "account": {
          "name": "account",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "token_secret_id": {
          "name": "token_secret_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "installer": {
          "name": "installer",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "connections": {
          "name": "connections",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "settings": {
          "name": "settings",
          "type": "jsonb",
          "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()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "integration_app_installation_organization_id_app_id_index": {
          "name": "integration_app_installation_organization_id_app_id_index",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "app_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "integration_app_installation_app_id_integration_app_id_fk": {
          "name": "integration_app_installation_app_id_integration_app_id_fk",
          "tableFrom": "integration_app_installation",
          "tableTo": "integration_app",
          "schemaTo": "coder",
          "columnsFrom": [
            "app_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "integration_app_installation_token_secret_id_secret_id_fk": {
          "name": "integration_app_installation_token_secret_id_secret_id_fk",
          "tableFrom": "integration_app_installation",
          "tableTo": "secret",
          "schemaTo": "coder",
          "columnsFrom": [
            "token_secret_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "integration_app_installation_key_unique": {
          "name": "integration_app_installation_key_unique",
          "nullsNotDistinct": false,
          "columns": [
            "key"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.platform_link": {
      "name": "platform_link",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "platform": {
          "name": "platform",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "platform_user_id": {
          "name": "platform_user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "organizations": {
          "name": "organizations",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "token": {
          "name": "token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "platform_link_user_id_index": {
          "name": "platform_link_user_id_index",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "platform_link_platform_platformUserId_unique": {
          "name": "platform_link_platform_platformUserId_unique",
          "nullsNotDistinct": false,
          "columns": [
            "platform",
            "platform_user_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.runner": {
      "name": "runner",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "public_id": {
          "name": "public_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "owner": {
          "name": "owner",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "scope": {
          "name": "scope",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "last_seen": {
          "name": "last_seen",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "secret_id": {
          "name": "secret_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "runner_secret_id_secret_id_fk": {
          "name": "runner_secret_id_secret_id_fk",
          "tableFrom": "runner",
          "tableTo": "secret",
          "schemaTo": "coder",
          "columnsFrom": [
            "secret_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "runner_organizationId_publicId_unique": {
          "name": "runner_organizationId_publicId_unique",
          "nullsNotDistinct": false,
          "columns": [
            "organization_id",
            "public_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.secret": {
      "name": "secret",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "iv": {
          "name": "iv",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "tag": {
          "name": "tag",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "ciphertext": {
          "name": "ciphertext",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "key_version": {
          "name": "key_version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "secret_organization_id_kind_index": {
          "name": "secret_organization_id_kind_index",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "kind",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.task": {
      "name": "task",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "public_id": {
          "name": "public_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "agent": {
          "name": "agent",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "flow": {
          "name": "flow",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "runner": {
          "name": "runner",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "permissions": {
          "name": "permissions",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "app_id": {
          "name": "app_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "installation_id": {
          "name": "installation_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "event": {
          "name": "event",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "prompt": {
          "name": "prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "args": {
          "name": "args",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "mcp": {
          "name": "mcp",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "author": {
          "name": "author",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "definition": {
          "name": "definition",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "credential": {
          "name": "credential",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "requester": {
          "name": "requester",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "runner_id": {
          "name": "runner_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "usage": {
          "name": "usage",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "tools": {
          "name": "tools",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "tool_scopes": {
          "name": "tool_scopes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "context": {
          "name": "context",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "files": {
          "name": "files",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "result": {
          "name": "result",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "tokens": {
          "name": "tokens",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "handle": {
          "name": "handle",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "token_hash": {
          "name": "token_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_seen_at": {
          "name": "last_seen_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "log_cursor": {
          "name": "log_cursor",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "log_seq": {
          "name": "log_seq",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "log_bytes": {
          "name": "log_bytes",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "archived_at": {
          "name": "archived_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "approval": {
          "name": "approval",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "answer": {
          "name": "answer",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "inbox_seq": {
          "name": "inbox_seq",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": -1
        },
        "inbox_ack": {
          "name": "inbox_ack",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": -1
        },
        "generation": {
          "name": "generation",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "locked_at": {
          "name": "locked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "finished_at": {
          "name": "finished_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "cancel_requested_at": {
          "name": "cancel_requested_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "task_public_id_index": {
          "name": "task_public_id_index",
          "columns": [
            {
              "expression": "public_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "task_organization_id_created_at_public_id_index": {
          "name": "task_organization_id_created_at_public_id_index",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": false,
              "nulls": "last"
            },
            {
              "expression": "public_id",
              "isExpression": false,
              "asc": false,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "task_organization_id_index": {
          "name": "task_organization_id_index",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "where": "\"coder\".\"task\".\"status\" = 'queued'",
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "task_status_created_at_index": {
          "name": "task_status_created_at_index",
          "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": {
        "task_app_id_integration_app_id_fk": {
          "name": "task_app_id_integration_app_id_fk",
          "tableFrom": "task",
          "tableTo": "integration_app",
          "schemaTo": "coder",
          "columnsFrom": [
            "app_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "task_installation_id_integration_app_installation_id_fk": {
          "name": "task_installation_id_integration_app_installation_id_fk",
          "tableFrom": "task",
          "tableTo": "integration_app_installation",
          "schemaTo": "coder",
          "columnsFrom": [
            "installation_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "task_organizationId_publicId_unique": {
          "name": "task_organizationId_publicId_unique",
          "nullsNotDistinct": false,
          "columns": [
            "organization_id",
            "public_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.task_inbox": {
      "name": "task_inbox",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "task_id": {
          "name": "task_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "seq": {
          "name": "seq",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "generation": {
          "name": "generation",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "at": {
          "name": "at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "task_inbox_task_id_generation_seq_index": {
          "name": "task_inbox_task_id_generation_seq_index",
          "columns": [
            {
              "expression": "task_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "generation",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "seq",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "task_inbox_task_id_task_id_fk": {
          "name": "task_inbox_task_id_task_id_fk",
          "tableFrom": "task_inbox",
          "tableTo": "task",
          "schemaTo": "coder",
          "columnsFrom": [
            "task_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "task_inbox_taskId_seq_unique": {
          "name": "task_inbox_taskId_seq_unique",
          "nullsNotDistinct": false,
          "columns": [
            "task_id",
            "seq"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.task_log": {
      "name": "task_log",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "task_id": {
          "name": "task_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "seq": {
          "name": "seq",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "at": {
          "name": "at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "level": {
          "name": "level",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "line": {
          "name": "line",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "task_log_task_id_task_id_fk": {
          "name": "task_log_task_id_task_id_fk",
          "tableFrom": "task_log",
          "tableTo": "task",
          "schemaTo": "coder",
          "columnsFrom": [
            "task_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "task_log_taskId_seq_unique": {
          "name": "task_log_taskId_seq_unique",
          "nullsNotDistinct": false,
          "columns": [
            "task_id",
            "seq"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "coder.usage": {
      "name": "usage",
      "schema": "coder",
      "columns": {
        "id": {
          "name": "id",
          "type": "bigserial",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "task_id": {
          "name": "task_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "installation_id": {
          "name": "installation_id",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "agent": {
          "name": "agent",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "target": {
          "name": "target",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "engine": {
          "name": "engine",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "credential": {
          "name": "credential",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "runner_ms": {
          "name": "runner_ms",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "tokens": {
          "name": "tokens",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "at": {
          "name": "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()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "usage_organization_id_at_index": {
          "name": "usage_organization_id_at_index",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "usage_task_id_task_id_fk": {
          "name": "usage_task_id_task_id_fk",
          "tableFrom": "usage",
          "tableTo": "task",
          "schemaTo": "coder",
          "columnsFrom": [
            "task_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "usage_installation_id_integration_app_installation_id_fk": {
          "name": "usage_installation_id_integration_app_installation_id_fk",
          "tableFrom": "usage",
          "tableTo": "integration_app_installation",
          "schemaTo": "coder",
          "columnsFrom": [
            "installation_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "usage_taskId_unique": {
          "name": "usage_taskId_unique",
          "nullsNotDistinct": false,
          "columns": [
            "task_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {
    "coder": "coder"
  },
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}