Users who don't have access to a postgres database (or don't have a postgres database) are unable to use the tooling. Now, the tempdb will just connect to the provided database and use that to spin off the temporary databases.
Setup a local database that did not have a postgres database:
go run ./cmd/pg-schema-diff apply --dsn "host=localhost user=postgres password=postgres database=reldbbplunkett" --schema-dir ~/stripe/temp/examplesql --allow-hazards INDEX_BUILD
################################## Review plan ##################################
1. ALTER TABLE "public"."foobar" ADD CONSTRAINT "some_constraint" CHECK((id > 0)) NOT VALID;
-- Statement Timeout: 3s
ALTER TABLE "public"."foobar" VALIDATE CONSTRAINT "some_constraint";
-- Statement Timeout: 3s
CREATE INDEX CONCURRENTLY some_idx ON public.foobar USING btree (id);
-- Statement Timeout: 20m0s
-- Lock Timeout: 3s
-- Hazard INDEX_BUILD: This might affect database performance. Concurrent index builds require a non-trivial amount of CPU, potentially affecting database performance. They also can take a while but do not lock out writes.
Finished executing statement. Duration: 941µs
############################# Executing statement 3 #############################
CREATE INDEX CONCURRENTLY some_idx ON public.foobar USING btree (id);
-- Statement Timeout: 20m0s
-- Lock Timeout: 3s
-- Hazard INDEX_BUILD: This might affect database performance. Concurrent index builds require a non-trivial amount of CPU, potentially affecting database performance. They also can take a while but do not lock out writes.
Description
Users who don't have access to a
postgres
database (or don't have apostgres
database) are unable to use the tooling. Now, the tempdb will just connect to the provided database and use that to spin off the temporary databases.Motivation
Bug fix
https://github.com/stripe/pg-schema-diff/issues/78
Testing
postgres
database:ALTER TABLE "public"."foobar" VALIDATE CONSTRAINT "some_constraint"; -- Statement Timeout: 3s
CREATE INDEX CONCURRENTLY some_idx ON public.foobar USING btree (id); -- Statement Timeout: 20m0s -- Lock Timeout: 3s -- Hazard INDEX_BUILD: This might affect database performance. Concurrent index builds require a non-trivial amount of CPU, potentially affecting database performance. They also can take a while but do not lock out writes.
✔ Yes ############################# Executing statement 1 ############################# ALTER TABLE "public"."foobar" ADD CONSTRAINT "some_constraint" CHECK((id > 0)) NOT VALID; -- Statement Timeout: 3s
Finished executing statement. Duration: 3.157042ms ############################# Executing statement 2 ############################# ALTER TABLE "public"."foobar" VALIDATE CONSTRAINT "some_constraint"; -- Statement Timeout: 3s
Finished executing statement. Duration: 941µs ############################# Executing statement 3 ############################# CREATE INDEX CONCURRENTLY some_idx ON public.foobar USING btree (id); -- Statement Timeout: 20m0s -- Lock Timeout: 3s -- Hazard INDEX_BUILD: This might affect database performance. Concurrent index builds require a non-trivial amount of CPU, potentially affecting database performance. They also can take a while but do not lock out writes.
Finished executing statement. Duration: 2.808ms ################################### Complete ################################### Schema applied successfully