Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Created May 23, 2016 10:02
Show Gist options
  • Save amitpatelx/30e64330e9d5ea2c1e17b4f2312f035e to your computer and use it in GitHub Desktop.
Save amitpatelx/30e64330e9d5ea2c1e17b4f2312f035e to your computer and use it in GitHub Desktop.
Override default primary key Raw - Solution
class CreateContentUnits < ActiveRecord::Migration
def up
create_table :content_units, id: false do |t|
t.boolean :active, default: false
end
execute 'ALTER TABLE content_units ADD guoid BIGINT(20) PRIMARY KEY AUTO_INCREMENT FIRST;'
end
def down
drop_table :guoids
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment