tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.63k stars 385 forks source link

Can't apply aerich migration, because of tortoise default table name #578

Open alexshurik opened 3 years ago

alexshurik commented 3 years ago

At first, thank you for such a great job! It's feel so good to use async ORM with familiar django-style. I'm planning to use tortoise in my new projects.

Describe the bug I'm not able to apply migration, describing user model creation. Aerich tries to create "user" table, if it's not exists, but Postgres has built-in pseudo-function, named "user'.

Can't apply aerich migration created for user model in postgres, because of tortoise default table name

To Reproduce

Expected behavior

Additional context I think, tortoise orm should add prefixes to default table name. E.g. django-style like _ or even tortoise_

Otherwise i have to override Meta.table in all my tortoise orm by myself.

MattOates commented 3 years ago

@alexshurik have you tried creating and specifying a schema rather than operating in public?