I am developing a postgres database with the following approximate number of entities:
- 60 tables spread across 7 schemas
- 20 views
- 20 functions
What’s the best practice for organizing all the DDL SQL?
I currently have a single SQL for the table definitions, another for the views and yet another for the functions. But two of these files have grown to over 1,000 lines each and become unwieldy. That said, there are relationships between tables in different schemas and one file makes these easy to manage.
Would it be better to organize the DDL by schema? Or finer grain still, at the entity level?
I am using JetBrains DataGrip and would appreciate that the solution still enable Intellisense and error checking. The SQL is stored in git.