mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
13 lines
420 B
Ruby
13 lines
420 B
Ruby
|
# frozen_string_literal: true
|
||
|
class AddCreatedAtToBadgeUser < ActiveRecord::Migration[6.0]
|
||
|
def up
|
||
|
add_column :user_badges, :created_at, :datetime, null: true
|
||
|
execute "UPDATE user_badges SET created_at = granted_at WHERE created_at IS NULL"
|
||
|
change_column :user_badges, :created_at, :datetime, null: false, default: "current_timestamp"
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
remove_column :user_badges, :created_at
|
||
|
end
|
||
|
end
|