Skip to content

Remove schema name from migrations for SapQueryRunner #10099

@philipphaeusle

Description

@philipphaeusle

Description

There issue Option to remove database name from migrations was fixed by this PR: fix: prevent using absolute table path in migrations unless required.

The Problem

The SapQueryRunner was not adopted in this PR. So the generated migration files still have the schema name in it.

The Solution

SapQueryRunner.ts:

     /**
     * Escapes given table or view path.
     */
    escapePath(target) {
        const { schema, tableName } = this.driver.parseTableName(target);
        if (schema) {
            return `"${schema}"."${tableName}"`;
        }
        return `"${tableName}"`;
    }

should be adapted to:

     /**
     * Escapes given table or view path.
     */
    escapePath(target) {
        const { schema, tableName } = this.driver.parseTableName(target);
        if (schema && schema !== this.driver.schema) {
            return `"${schema}"."${tableName}"`;
        }
        return `"${tableName}"`;
    }

As seen here for the other QueryRunners.

Relevant Database Driver(s)

  • sap

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions