Fixing Migration crashes on MySQL/MariaDB & PostgreSQL
This commit is contained in:
parent
2a0552d6b2
commit
6cd1de21dd
7 changed files with 78 additions and 38 deletions
|
|
@ -2,8 +2,16 @@
|
|||
|
||||
class CreateVisits < ActiveRecord::Migration
|
||||
def change
|
||||
adapter_type = connection.adapter_name.downcase.to_sym
|
||||
|
||||
create_table :visits do |t|
|
||||
t.uuid :visitor_id
|
||||
case adapter_type
|
||||
when :postgresql
|
||||
t.uuid :visitor_id
|
||||
else
|
||||
t.integer :visitor_id
|
||||
end
|
||||
|
||||
|
||||
# the rest are recommended but optional
|
||||
# simply remove the columns you don't want
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue