pgschema
pgschema copied to clipboard
Terraform-style, declarative Postgres schema migration. Agent friendly.
~~~sql --script.sql CREATE SCHEMA app; ALTER SCHEMA app OWNER To user1; ~~~ `pgschema plan --user user1 --db db --password ... --file script.sql` fails with `Error: failed to apply desired state:...
## Summary Following the fix in PR #222 for function qualifier normalization (issue #220), we're still seeing perpetual diffs when policy expressions reference tables with same-schema qualifiers. ## Context PR...
`createdb db` ~~~sql CREATE SCHEMA app; CREATE FUNCTION app.func() RETURNS INTEGER LANGUAGE sql IMMUTABLE AS $$ SELECT 1; $$; CREATE TABLE app.article ( article integer, article_code INTEGER GENERATED ALWAYS AS...
## Context We recently migrated from Supabase's declarative schema management to pgschema's declarative approach. (Supabase supports both migrations and a declarative mode where you define schema in SQL files—we were...
If you want to migrate from Supabase's declarative schema management to pgschema, please read below: - Real customer experience: https://github.com/pgschema/pgschema/issues/227. This particular journey lists 5 issues during the migration. The...
I ran into a behavior that got me curious about the project's design intent. When adding a new column with a `COMMENT ON COLUMN`, it takes two plan/apply cycles to...
Given the following database definition: ```sql CREATE TABLE accounts(user_id INT, balance INT); CREATE OR REPLACE FUNCTION transfer_funds(sender_id INT, receiver_id INT, amount NUMERIC) RETURNS void LANGUAGE SQL BEGIN ATOMIC UPDATE accounts...
Given the following database: ```sql create schema some_schema; -- used for clock stubbing in test suites CREATE FUNCTION some_schema.today() RETURNS date LANGUAGE sql STABLE RETURN (now())::date; -- create a function...
### Step 1 Add some tables: ```sql CREATE TABLE b ( id serial, owner_id integer NOT NULL, PRIMARY KEY (id) ); CREATE TABLE a ( id serial, b_id integer NOT...
Probably order issue again? ### Step 1 Alter default privilages by applying this: ```sql CREATE USER postgres; -- Why the tmp database has a different username(pgschema) than the one we're...