Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ThomasLandauer opened this issue Mar 14, 2025 · 0 comments

Comments

@ThomasLandauer
Copy link
Contributor

Bug Report

Q A
Version 4.2.3

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 here).

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant