Class: CreateDynabutes

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/dynabute/templates/migration.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generators/dynabute/templates/migration.rb', line 2

def change
  create_table "dynabute_fields", force: :cascade do |t|
    t.string   "name", limit: 50
    t.string   "value_type", limit: 15
    t.boolean  "has_many", default: false
    t.string   "target_model", limit: 50
  end
  add_index "dynabute_fields", ["target_model", "name"], name: "index_dynabute_fields_on_target_model_and_name", using: :btree

  create_table "dynabute_string_values", force: :cascade do |t|
    t.integer  "field_id", limit: 4
    t.integer  "dynabutable_id", limit: 4
    t.string   "dynabutable_type", limit: 50
    t.string   "value", limit: 255
  end
  add_index "dynabute_string_values", ["dynabutable_id"], name: "dynabute_string_values_on_recordable_id", using: :btree
  add_index "dynabute_string_values", ["dynabutable_id", "field_id"], name: "dynabute_string_values_on_record_id_and_recordable_id", using: :btree

  create_table "dynabute_integer_values", force: :cascade do |t|
    t.integer  "field_id", limit: 4
    t.integer  "dynabutable_id", limit: 4
    t.string   "dynabutable_type", limit: 50
    t.integer  "value"
  end
  add_index "dynabute_integer_values", ["dynabutable_id"], name: "dynabute_integer_values_on_recordable_id", using: :btree
  add_index "dynabute_integer_values", ["dynabutable_id", "field_id"], name: "dynabute_integer_values_on_record_id_and_recordable_id", using: :btree

  create_table "dynabute_boolean_values", force: :cascade do |t|
    t.integer  "field_id", limit: 4
    t.integer  "dynabutable_id", limit: 4
    t.string   "dynabutable_type", limit: 50
    t.boolean  "value"
  end
  add_index "dynabute_boolean_values", ["dynabutable_id"], name: "dynabute_boolean_values_on_recordable_id", using: :btree
  add_index "dynabute_boolean_values", ["dynabutable_id", "field_id"], name: "dynabute_boolean_values_on_record_id_and_recordable_id", using: :btree

  create_table "dynabute_datetime_values", force: :cascade do |t|
    t.integer  "field_id", limit: 4
    t.integer  "dynabutable_id", limit: 4
    t.string   "dynabutable_type", limit: 50
    t.datetime "value"
  end
  add_index "dynabute_datetime_values", ["dynabutable_id"], name: "dynabute_datetime_values_on_recordable_id", using: :btree
  add_index "dynabute_datetime_values", ["dynabutable_id", "field_id"], name: "dynabute_datetime_values_on_record_id_and_recordable_id", using: :btree
end