Project

pg_objects

0.0
There's a lot of open issues
A long-lived project that still receives updates
Simple manager for PostgreSQL objects like triggers and functions
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 6.1.7.0, < 8
>= 4, < 8
 Project Readme

Gem Version Maintainability

PgObjects

Simple manager for PostgreSQL objects like triggers and functions.

Inspired by https://github.com/neongrau/rails_db_objects

Installation

Add this line to your application's Gemfile:

gem 'pg_objects'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pg_objects

Usage

Put DB objects as CREATE (or CREATE OR UPDATE) queries in files to directory structure (default: db/objects).

You can control order of creating by using directive depends_on in SQL comment:

--!depends_on my_another_func
CREATE FUNCTION my_func()
...

The string after directive should be a name of file with dependency without extension.

Configuration

Create file in config/initializers with the following content:

PgObjects.configure do |config|
  config.directories = ['db/objects', 'another/path/to/files'] # default: 'db/objects'
  config.extensions = ['sql', 'txt'] # default: 'sql'
  config.silent = false # whether to suppress output to console
end

Otherwise default values will be used.

Remember, you take care the specified directories are exist.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/marinazzio/pg_objects.