Skip to content

Schema Tool keeps recreating table user when inside a schema in PostgreSQL #11898

Open
@ThomasLandauer

Description

@ThomasLandauer

Bug Report

Q A
Version 3.3.2

Summary

With the following mapping:

#[ORM\Table(schema: 'my')]
class User

whenever I rerun bin/console make:migration, I'm getting:

$this->addSql('CREATE TABLE my."user" (...)');
$this->addSql('DROP TABLE my."user"');

This is apparently due to user being a reserved word in SQL (or PostgreSQL), and the escaping Doctrine applies (as discussed in various issues at DBAL).

When I remove the schema, it works as expected:

[WARNING] No database changes were detected.

Workaround:
Rename the table in the database:

#[ORM\Table(name: 'users', schema: 'my')]

Current behavior

Expected behavior

How to reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions