ActiveRecord 模型生成器:reactive_record

jopen 11年前

reactive_record 能根据现有的 Postgres 数据库生成  ActiveRecord 模型。

特性

  • Fully automatic. It just works.
  • Creates a model for every table.
  • Creates a comprehensive initial migration.
  • Declares key-, uniqueness-, and presence-constraints.
  • Creates associations.
  • Adds custom validation methods for CHECK constraints.

class CreateEmployees < ActiveRecord::Migration    def up      execute <<-SQL        CREATE TABLE employees (          id         SERIAL,          name       VARCHAR(255) NOT NULL,          email      VARCHAR(255) NOT NULL UNIQUE,          start_date DATE NOT NULL,            PRIMARY KEY (id),          CONSTRAINT company_email CHECK (email LIKE '%@example.com')        );      SQL    end      def down      drop_table :employees    end  end

    ActiveRecord 模型生成器:reactive_record

    项目主页:http://www.open-open.com/lib/view/home/1387206977843