hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.18k stars 2.76k forks source link

[feature request] lint migration sql #2713

Closed jjangga0214 closed 5 years ago

jjangga0214 commented 5 years ago

Hi!

Thank you for this great BaaS!

While creating migration files, I found generated sql is not linted. Like below example, they are hard for human to read.

CREATE TRIGGER set_public_tag_updated_at BEFORE UPDATE ON public.tag FOR EACH ROW EXECUTE PROCEDURE public.set_current_timestamp_updated_at();
COMMENT ON TRIGGER set_public_tag_updated_at ON public.tag IS 'trigger to set value of column "updated_at" to current timestamp on row update';
ALTER TABLE ONLY public.article
    ADD CONSTRAINT article_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.author(id) ON UPDATE CASCADE ON DELETE CASCADE;

If this is not intentional, I think formatting them would be good! There is a opensource Postgres formatter like https://github.com/darold/pgFormatter as well.

How do you think?

marionschleifer commented 5 years ago

@jjangga0214 I'm closing this issue in favour of this one: https://github.com/hasura/graphql-engine/issues/2635, which is a duplicate 🙂