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

Create schemas for postgres schema generator #1682

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

yogsagot
Copy link

Description

Generating schema added support for postgres schemas.

Motivation and Context

Model's metaclass has schema attribute that is not reflected in database schema generation.

How Has This Been Tested?

Created number of models with schema defined in their Meta class.
Successfully created corresponding schemas and tables inside schemas.
Also created foreign keys that target tables in other schemas.
Also created comments on columns.

Did not test creating indexes and m2m relations.
Indexes probably should fail. M2M should work.
Did not make any changes to aerich.

Checklist:

  • [+] My code follows the code style of this project.
  • [-] My change requires a change to the documentation.
  • [-] I have updated the documentation accordingly.
  • [-] I have added the changelog accordingly.
  • [-] I have read the CONTRIBUTING document.
  • [-] I have added tests to cover my changes.
  • [-] All new and existing tests passed.

@abondar
Copy link
Member

abondar commented Jul 28, 2024

Please try creating tests for that, we already have some postgres schema tests here
https://github.com/tortoise/tortoise-orm/blob/develop/tests/schema/test_generate_schema.py#L799

Also run make style make lint to lint the code

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

Successfully merging this pull request may close these issues.

2 participants