squawk
squawk copied to clipboard
🐘 linter for PostgreSQL, focused on migrations
I don't wanna fix those errors myself becouse usually this kind of error could be fixed automatically. ``` 16: ALTER TABLE some_table_name drop constraint if exists constrain_name;
Calling `validate constraint` in a transaction defeats the purpose of using `not valid` ```sql begin; ALTER TABLE "email" ADD CONSTRAINT "fk_user" FOREIGN KEY ("user_id") REFERENCES "user" ("id") NOT VALID; ALTER...
it recommends: ``` help: Consider wrapping in a transaction or adding a IF NOT EXISTS clause if the statment supports it. ``` when it should say ``` help: Consider wrapping...
Input SQL ```sql create table app.users ( id bigint generated by default as identity primary key, "name" text not null, created_ts timestamptz not null default now(), age smallint not null...
I think Squawk shouldn't complain here because there won't be any rows in our table so the lock will be short. ``` stdin:1:0: warning: adding-foreign-key-constraint 1 | CREATE TABLE IF...
Related to #116 We could accept an input file that would include table name, row count, index size, table size, etc. and use that information to display more useful error...
I'd like to exclude old `.sql` files from the linter check to integrate it in our pipeline. The reason being that I want to fail the build if squawk complains,...
I'm integrating Squawk into a CI pipeline and want to be able to tell it to ignore specific queries, similar to ```rust #[allow(clippy::some_rule)] // some code that would fail ```...
Also should note the differences between a new table, and adding to an existing table https://gocardless.com/blog/zero-downtime-postgres-migrations-the-hard-parts/ https://medium.com/braintree-product-technology/postgresql-at-scale-database-schema-changes-without-downtime-20d3749ed680 https://travisofthenorth.com/blog/2017/2/2/postgres-adding-foreign-keys-with-zero-downtime