Skip to content

trustly/fdiff

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

fdiff

Tool to reduce risk for human errors when deploying functions and views in a PostgreSQL database.

USAGE

BEGIN;

-- Temp store state of all views/functions
SELECT fstage();

-- Deploy changes to schema
-- CREATE OR REPLACE FUNCTION ...
-- CREATE OR REPLACE VIEW ...

-- Show a diff of changes made
SELECT fdiff();

-- If the changes are expected, go ahead and commit
COMMIT;

EXAMPLE

$ psql
psql (9.1.9)
Type "help" for help.

amazon=# BEGIN;
BEGIN
amazon=#* select fstage();
 fstage 
--------
 t
(1 row)

amazon=#* \i /Users/joel/schema/public/FUNCTIONS/process_order.sql
SET
CREATE FUNCTION
ALTER FUNCTION
amazon=#* select fdiff();
                                                 fdiff                                                  
--------------------------------------------------------------------------------------------------------
                                                                                                       +
                                                                                                       +
 +-------------------------------+                                                                     +
 | Updated or replaced functions |                                                                     +
 +-------------------------------+                                                                     +
                                                                                                       +
 Schema................: public                                                                        +
 Name..................: process_order                                                                 +
 Argument data types...: _orderid bigint                                                               +
 Result data type......: boolean                                                                       +
 Language..............: plpgsql                                                                       +
 Type..................: normal                                                                        +
 Volatility............: STABLE                                                                        +
 Owner.................: amazon                                                                        +
 20 c     OR Orders.ShippingDate IS NOT NULL                                                           +
 20 c     OR Orders.ShippingDate > now() - interval '2 month'                                          +
                                                                                                       +
                                                                                                       +
                                                                                                       +
 
(1 row)

amazon=#* COMMIT;
COMMIT

INSTALL

./install.sh

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages