Merged migrations.

This commit is contained in:
Martin Edenhofer 2015-08-19 01:03:28 +02:00
parent ee5e084b63
commit c3eea0b8af
3 changed files with 7 additions and 22 deletions

View file

@ -6,14 +6,19 @@ class CreateUserDevices < ActiveRecord::Migration
t.string :name, limit: 250, null: false
t.string :os, limit: 150, null: true
t.string :browser, limit: 250, null: true
t.string :country, limit: 150, null: true
t.string :location, limit: 150, null: true
t.string :device_details, limit: 2500, null: true
t.string :location_details, limit: 2500, null: true
t.string :fingerprint, limit: 160, null: true
t.string :user_agent, limit: 250, null: true
t.string :ip, limit: 160, null: true
t.timestamps
end
add_index :user_devices, [:user_id]
add_index :user_devices, [:os, :browser, :country]
add_index :user_devices, [:os, :browser, :location]
add_index :user_devices, [:fingerprint]
add_index :user_devices, [:updated_at]
add_index :user_devices, [:created_at]
end
def down

View file

@ -1,9 +0,0 @@
class UpdateUserDevices < ActiveRecord::Migration
def up
add_column :user_devices, :location, :string, limit: 150, null: true
remove_column :user_devices, :country
add_index :user_devices, [:os, :browser, :location]
UserDevice.reset_column_information
end
end

View file

@ -1,11 +0,0 @@
class UpdateUserDevices2 < ActiveRecord::Migration
def up
add_column :user_devices, :user_agent, :string, limit: 250, null: true
add_column :user_devices, :ip, :string, limit: 160, null: true
add_column :user_devices, :fingerprint, :string, limit: 160, null: true
add_index :user_devices, [:fingerprint]
add_index :user_devices, [:created_at]
UserDevice.reset_column_information
end
end