Skip to content

ide.json: Database ​

Overview ​

The database section configures how Laravel Idea understands your database schema and migration methods.

database.columnMigrationMethods ​

Registers custom Blueprint methods that define database columns. Laravel Idea uses these to understand what column a migration method creates, enabling column-aware completions (e.g. field names in Eloquent models).

There are two forms: single-column methods and multi-column methods.

Single-column method ​

Used when the method creates exactly one column.

FieldRequiredDescription
nameYesMethod name on the Blueprint.
typeYes (single-column form)Column data type. One of: "string", "integer", "float", "boolean", "array", "timestamp", "other".
nameParameterIndexYes (if columnNameTemplate not set)1-based index of the parameter holding the column name.
columnNameTemplateYes (if nameParameterIndex not set)Fixed column name template (for methods with no name parameter).
defaultNameYes (single-column form)Default column name used when no name is provided.
json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "database": {
        "columnMigrationMethods": [
            {
                "name": "tenantId",
                "type": "integer",
                "nameParameterIndex": 1,
                "defaultName": "tenant_id"
            },
            {
                "name": "softDeletesTz",
                "type": "timestamp",
                "columnNameTemplate": "deleted_at",
                "defaultName": "deleted_at"
            }
        ]
    }
}

Multi-column method ​

Used when a single method creates multiple columns at once (e.g. $table->morphs('taggable') creates taggable_id and taggable_type). Use the columns array instead of type/nameParameterIndex.

Each entry in columns has:

FieldRequiredDescription
nameYesColumn name template.
typeYesColumn data type (same values as above).
json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "database": {
        "columnMigrationMethods": [
            {
                "name": "customMorphs",
                "columns": [
                    { "name": "${PARAMETER_1}_id", "type": "integer" },
                    { "name": "${PARAMETER_1}_type", "type": "string" }
                ]
            }
        ]
    }
}

${PARAMETER_1} is replaced with the first parameter value passed to the method. Second, third and other parameters are supported by ${PARAMETER_%INDEX%} variable. See Template language for more information.

database.schemaDirectories ​

Additional directories where Laravel Idea looks for schema definition files (e.g. SQL dump files used to infer tables and columns for Eloquent models).

json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "database": {
        "schemaDirectories": [
            "/database/schemas/tenant"
        ]
    }
}

Path resolution follows the same rules as other path fields: /path is absolute from the project root; path or ../path is relative to the folder containing ide.json.

database.schemaFilePaths ​

Explicit paths to individual schema files.

json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "database": {
        "schemaFilePaths": [
            "/database/schema.sql",
            "/database/tenant-schema.sql"
        ]
    }
}