ActiveRecord Constraints


#1

A plugin to easily add constraints into a PostgreSQL database. I think
it would be easy to add other database engines to it assuming they
implement constraints.

The GIT repository is here:

The rdoc is here:

http://pedz.github.com/activerecord_constraints

A small snippet from the readme:

Unique Constraint:

class CreateFoos < ActiveRecord::Migration
  def self.up
    create_table :foos do |t|
      # name will have a "unique" constraint
      t.string :name, :null => false, :unique => true
    end
  end
end

Trivial foreign key constraint:

class CreateFoos < ActiveRecord::Migration
  def self.up
    create_table :foos do |t|
      # bar_id will now be a foreign key constraint column id in

table bar
t.integer :bar_id, :null => false, :reference => true
end
end
end