drizzle-cli 0.1.4

Command-line interface for drizzle-rs migrations
Documentation
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/themixednuts/drizzle-rs/main/cli/schema.json",
  "title": "Drizzle Configuration",
  "description": "Configuration schema for drizzle-rs CLI tool (compatible with drizzle-kit)",
  "definitions": {
    "envOr": {
      "description": "A value that can be a direct string or an environment variable reference",
      "oneOf": [
        { "type": "string" },
        {
          "type": "object",
          "required": ["env"],
          "properties": {
            "env": {
              "type": "string",
              "description": "Environment variable name"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "schemaPath": {
      "description": "Path or array of paths to schema files (glob patterns supported)",
      "oneOf": [
        { "type": "string" },
        {
          "type": "array",
          "items": { "type": "string" },
          "minItems": 1
        }
      ],
      "default": "src/schema.rs"
    },
    "filter": {
      "oneOf": [
        { "type": "string" },
        {
          "type": "array",
          "items": { "type": "string" }
        }
      ]
    },
    "casing": {
      "description": "Casing mode for generated code and SQL identifiers",
      "type": "string",
      "enum": ["camelCase", "snake_case"],
      "default": "camelCase"
    },
    "introspectCasing": {
      "description": "Casing mode for introspected identifiers",
      "type": "string",
      "enum": ["camel", "preserve"],
      "default": "camel"
    },
    "introspect": {
      "description": "Introspection configuration",
      "type": "object",
      "properties": {
        "casing": {
          "$ref": "#/definitions/introspectCasing"
        }
      },
      "additionalProperties": false
    },
    "rolesFilter": {
      "description": "Roles filter configuration (PostgreSQL only)",
      "oneOf": [
        {
          "type": "boolean",
          "description": "true = include all user roles, false = exclude all"
        },
        {
          "type": "object",
          "properties": {
            "provider": {
              "type": "string",
              "description": "Provider preset (e.g., 'supabase', 'neon') - excludes provider-specific roles",
              "enum": ["supabase", "neon"]
            },
            "include": {
              "type": "array",
              "items": { "type": "string" },
              "description": "Explicit list of role names to include"
            },
            "exclude": {
              "type": "array",
              "items": { "type": "string" },
              "description": "Explicit list of role names to exclude"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "entities": {
      "description": "Entities filter configuration",
      "type": "object",
      "properties": {
        "roles": {
          "$ref": "#/definitions/rolesFilter"
        }
      },
      "additionalProperties": false
    },
    "extensionsFilters": {
      "description": "Extensions filter (PostgreSQL only)",
      "type": "array",
      "items": {
        "type": "string",
        "enum": ["postgis"]
      }
    },
    "migrations": {
      "description": "Migration table configuration",
      "type": "object",
      "properties": {
        "table": {
          "description": "Custom table name for migrations (default: __drizzle_migrations)",
          "type": "string",
          "default": "__drizzle_migrations"
        },
        "schema": {
          "description": "Schema for migrations table (PostgreSQL only, default: drizzle)",
          "type": "string",
          "default": "drizzle"
        },
        "prefix": {
          "description": "Migration file naming prefix",
          "type": "string",
          "enum": ["index", "timestamp", "supabase", "unix", "none"]
        }
      },
      "additionalProperties": false
    },
    "dbCredentials": {
      "description": "Database credentials",
      "oneOf": [
        {
          "type": "object",
          "description": "URL-based credentials (SQLite file path, Turso/LibSQL URL, PostgreSQL connection string)",
          "required": ["url"],
          "properties": {
            "url": { "$ref": "#/definitions/envOr" },
            "authToken": {
              "$ref": "#/definitions/envOr",
              "description": "Auth token for Turso/LibSQL connections"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "description": "Host-based credentials for PostgreSQL",
          "required": ["host", "database"],
          "properties": {
            "host": { "$ref": "#/definitions/envOr" },
            "port": { "type": "integer", "minimum": 1, "maximum": 65535, "default": 5432 },
            "user": { "$ref": "#/definitions/envOr" },
            "password": { "$ref": "#/definitions/envOr" },
            "database": { "$ref": "#/definitions/envOr" },
            "ssl": {
              "oneOf": [
                { "type": "boolean" },
                { "type": "string", "enum": ["require", "allow", "prefer", "verify-full", "disable"] }
              ]
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "commonConfig": {
      "type": "object",
      "properties": {
        "schema": { "$ref": "#/definitions/schemaPath" },
        "out": {
          "description": "Output directory for migrations",
          "type": "string",
          "default": "./drizzle"
        },
        "breakpoints": {
          "description": "Whether to use SQL breakpoints in generated migrations",
          "type": "boolean",
          "default": true
        },
        "tablesFilter": {
          "description": "Table filter for push/introspect commands (glob patterns)",
          "$ref": "#/definitions/filter"
        },
        "verbose": {
          "description": "Verbose output",
          "type": "boolean",
          "default": false
        },
        "strict": {
          "description": "Deprecated: use explain flag instead",
          "type": "boolean",
          "default": false,
          "deprecated": true
        },
        "casing": { "$ref": "#/definitions/casing" },
        "migrations": { "$ref": "#/definitions/migrations" },
        "introspect": { "$ref": "#/definitions/introspect" },
        "dbCredentials": { "$ref": "#/definitions/dbCredentials" }
      }
    },
    "sqliteConfig": {
      "allOf": [
        { "$ref": "#/definitions/commonConfig" },
        {
          "type": "object",
          "required": ["dialect"],
          "properties": {
            "dialect": {
              "description": "Database dialect",
              "type": "string",
              "const": "sqlite"
            },
            "driver": {
              "description": "Database driver",
              "type": "string",
              "enum": ["rusqlite"]
            }
          }
        }
      ]
    },
    "tursoConfig": {
      "allOf": [
        { "$ref": "#/definitions/commonConfig" },
        {
          "type": "object",
          "required": ["dialect"],
          "properties": {
            "dialect": {
              "description": "Database dialect",
              "type": "string",
              "const": "turso"
            },
            "driver": {
              "description": "Database driver",
              "type": "string",
              "enum": ["libsql", "turso"]
            }
          }
        }
      ]
    },
    "postgresConfig": {
      "allOf": [
        { "$ref": "#/definitions/commonConfig" },
        {
          "type": "object",
          "required": ["dialect"],
          "properties": {
            "dialect": {
              "description": "Database dialect",
              "type": "string",
              "enum": ["postgresql", "postgres"]
            },
            "driver": {
              "description": "Database driver",
              "type": "string",
              "enum": ["postgres-sync", "tokio-postgres"]
            },
            "schemaFilter": {
              "description": "Schema filter for PostgreSQL (default: ['public'])",
              "$ref": "#/definitions/filter"
            },
            "extensionsFilters": {
              "$ref": "#/definitions/extensionsFilters"
            },
            "entities": {
              "$ref": "#/definitions/entities"
            }
          }
        }
      ]
    },
    "multiDbConfig": {
      "type": "object",
      "required": ["databases"],
      "properties": {
        "databases": {
          "description": "Named database configurations for multi-database setup",
          "type": "object",
          "additionalProperties": {
            "oneOf": [
              { "$ref": "#/definitions/sqliteConfig" },
              { "$ref": "#/definitions/tursoConfig" },
              { "$ref": "#/definitions/postgresConfig" }
            ]
          },
          "minProperties": 1
        }
      },
      "additionalProperties": false
    }
  },
  "oneOf": [
    { "$ref": "#/definitions/sqliteConfig" },
    { "$ref": "#/definitions/tursoConfig" },
    { "$ref": "#/definitions/postgresConfig" },
    { "$ref": "#/definitions/multiDbConfig" }
  ]
}