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
|
# File 'lib/generators/thecore_settings/templates/migration.rb', line 2
def change
create_table :thecore_settings do |t|
t.boolean :enabled, default: true
t.string :kind, null: false, default: 'string'
t.string :ns, default: 'main'
t.string :key, null: false
if Object.const_defined?('Geocoder')
t.float :latitude
t.float :longitude
end
t.text :raw
t.string :label
if defined?(Paperclip)
t.attachment :file
elsif defined?(CarrierWave)
t.string :file
elsif defined?(Shrine)
t.text :file_data
end
t.timestamps
end
add_index :thecore_settings, :key
add_index :thecore_settings, [:ns, :key], unique: true
end
|