Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
This gem implements add_foreign_key and remove_foreign_key for PostgreSQLAdapter.
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
test
MIT-LICENSE
Manifest
README.mkdn
Rakefile
postgresql_migrations.gemspec
postgresql_migrations.rb

README.mkdn

Postgresql Migrations

DESCRIPTION

This gem implements "add_foreign_key" and "remove_foreign_key" for PostgreSQLAdapter.

REQUIREMENTS

  • activerecord
  • postgres

INSTALLATION

$ sudo gem sources -a http://gems.github.com (you only have to do this once)
$ sudo gem install rafaelp-postgresql_migrations

USAGE

Example 1

require 'postgresql_migrations'
class UserBelongsToAccount < ActiveRecord::Migration
  def self.up
    add_foreign_key :users, :account_id, :accounts, :id
  end

  def self.down
    remove_foreign_key :users, :account_id
  end
end

Example 2

require 'postgresql_migrations'
class UserBelongsToAccount < ActiveRecord::Migration
  def self.up
    add_foreign_key :users, :account_id, :accounts, :id, :match => 'simple', :on_delete => 'restrict', :on_update => 'cascade'
  end

  def self.down
    remove_foreign_key :users, :account_id
  end
end

LICENSE

Postgresql Migrations is released under the MIT License.

AUTHOR

Rafael Lima

Working at Myfreecomm

Blog: http://rafael.adm.br

Podcast: http://rafael.adm.br/voltandopracasa

Github: http://github.com/rafaelp

Twitter: http://twitter.com/rafaelp

Did you like?

Recommend me at Working With Rails

Something went wrong with that request. Please try again.