stripe / pg-schema-diff

Go library for diffing Postgres schemas and generating SQL migrations
MIT License
270 stars 20 forks source link

Use logfmt for plan modifiers #109

Closed bplunkett-stripe closed 4 months ago

bplunkett-stripe commented 4 months ago

Description

Motivation

Fixed #62

Testing

 ~/stripe/pg-schema-diff │ bplunkett/ov…an-modifiers  go run ./cmd/pg-schema-diff plan  --dsn "host=localhost user=postgres password=postgres database=somedb" --schema-dir ~/stripe/temp/examplesql -s 'index=1 timeout=2h lock_timeout=3m statement="SOME INSERTED STATEMENT"' --exclude-schema=public --lock-timeout-modifier='pattern="TABLE" timeout=1m' --statement-timeout-modifier='pattern="DROP" timeout=5m' --statement-timeout-modifier='pattern="DOESNT APPLY TO ANYTHING" timeout=100m'

################################ Generated plan ################################
1. DROP TABLE "some_schema"."foobar";
        -- Statement Timeout: 5m0s
        -- Lock Timeout: 1m0s
        -- Hazard DELETES_DATA: Deletes all rows in the table (and the table itself)

2. SOME INSERTED STATEMENT;
        -- Statement Timeout: 2h0m0s
        -- Lock Timeout: 3m0s
        -- Hazard IS_USER_GENERATED: This statement is user-generated

3. DROP SCHEMA "some_schema";
        -- Statement Timeout: 5m0s
        -- Lock Timeout: 3s