This repository has been archived on 2024-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
redstoner.com/db/migrate/20170319193517_add_badge_id_to_users.rb

18 lines
487 B
Ruby

class AddBadgeIdToUsers < ActiveRecord::Migration
def change
create_table "badges", force: :cascade do |t|
t.string "name"
t.string "symbol"
t.string "color"
end
Badge.create!({name: "none", symbol: "", color: "#000"})
dbadge = Badge.create!({name: "donor", symbol: "$", color: "#f60"})
add_column :users, :badge_id, :integer, default: 1
User.where(donor: true).update_all(badge_id: dbadge.id)
remove_column :users, :donor
end
end