PostgreSQL Framework

It's simple framework for PostgreSQL database with unit tests and versioning.

Created based on:

Install framework

bundle install

Add framework scripts

bundle exec sem-add-framework

Add script

bundle exec sem-add-safe ./new-script.sql

Applying changes to your local database

bundle exec sem-apply --url postgresql://postgres@localhost/sample --password

Other commands

Go to Schema Evolution Manager (sem).

Run tests

BEGIN TRANSACTION;
SELECT * FROM unit_tests.begin();
ROLLBACK TRANSACTION;

Writing tests

Go to PostgreSQL Unit Testing Framework.

Uninstall tests

DROP SCHEMA IF EXISTS assert CASCADE;
DROP SCHEMA IF EXISTS unit_tests CASCADE;
DROP DOMAIN IF EXISTS public.test_result CASCADE;

Uninstall framework

It's' dangerous.

DROP SCHEMA IF EXISTS framework CASCADE;