Sha256: dbc40f4065ce0706ce767481730544c211a5b8467adc0d3794fd06f436e9f5bf

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

class AddUserDefinedFields < ActiveRecord::Migration
  def up

    unless table_exists? :user_defined_data
      create_table :user_defined_data do |t|
        t.string :scope
        t.string :model_name

        t.timestamps
      end

      add_index :user_defined_data, :scope
    end

    unless table_exists? :user_defined_fields
      create_table :user_defined_fields do |t|
        t.string :field_name
        t.string :label
        t.string :data_type
        t.references :user_defined_data

        t.timestamps
      end

      add_index :user_defined_fields, :user_defined_data_id
      add_index :user_defined_fields, :field_name
    end

  end

  def down

    if table_exists? :user_defined_data
      drop_table :user_defined_data
    end

    if table_exists? :user_defined_fields
      drop_table :user_defined_fields
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
erp_tech_svcs-4.0.0 db/migrate/20131129203603_add_user_defined_fields.rb