cirandas.net

ref: master

plugins/suppliers/db/migrate/20130704000000_create_suppliers_plugin_tables.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class CreateSuppliersPluginTables < ActiveRecord::Migration
  def self.up
    # check if distribution plugin already moved the table
    return if ApplicationRecord.connection.table_exists? :suppliers_plugin_suppliers

    create_table :suppliers_plugin_suppliers do |t|
      t.integer  :profile_id
      t.integer  :consumer_id
      t.string   :name
      t.string   :name_abbreviation
      t.text     :description
      t.timestamps
    end

    add_index :suppliers_plugin_suppliers, [:consumer_id]
  end

  def self.down
    drop_table :suppliers_plugin_suppliers
  end
end