https://github.com/trustly/fdiff
https://github.com/trustly/fdiff
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/trustly/fdiff
- Owner: trustly
- License: mit
- Created: 2013-04-24T12:51:02.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-10-20T14:35:48.000Z (over 10 years ago)
- Last Synced: 2024-08-13T07:15:58.032Z (6 months ago)
- Language: Shell
- Size: 133 KB
- Stars: 35
- Watchers: 13
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - trustly/fdiff - (Shell)
README
# 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