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

Adapt crud-admin-generator to work using PostgreSQL #122

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bepetersn
Copy link

@bepetersn bepetersn commented Jun 6, 2019

I don't know if someone will find this useful, but it seems possible because I needed it. This breaks support for MySQL and I'm not making an attempt to fix that, so please don't consider this an actual pull request as I don't want to break your library. Rather, I hope this helps someone. If you wanted to try to incorporate it, I think it could be manageable. Thanks for doing the work you did on this.

In order to query the columns from each table it was convenient for me to construct a VIEW to make the query a little shorter. Here's how I defined that view:

CREATE VIEW table_column_constraints as (SELECT c.table_schema, c.table_name, c.column_name
, c.data_type
, c.is_nullable
, tc.constraint_type
, c.column_default
FROM information_schema.columns AS c
LEFT JOIN information_schema.constraint_column_usage AS ccu USING (column_name, table_name)
LEFT JOIN information_schema.table_constraints tc ON tc.constraint_name=ccu.constraint_name WHERE c.table_schema='public');

NOTE: I haven't taken the time to get bulk downloads working. Not sure what is wrong. Everything else appears to be working as a baseline. There are also some ephemeral errors on update which I haven't fixed because they only flash on-screen before disappearing and the update succeeding.

@bepetersn
Copy link
Author

For others, calling it postgres, pgsql as well

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.

1 participant