Fixing Migration crashes on MySQL/MariaDB & PostgreSQL

This commit is contained in:
Jose D. Gomez R 2019-03-12 17:04:13 -04:00 committed by José D. Gómez R
parent 2a0552d6b2
commit 6cd1de21dd
7 changed files with 78 additions and 38 deletions

View file

@ -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