1 class MakeUsersLoginNotNull < ActiveRecord::Migration
3 execute "UPDATE users SET login = CONCAT('user-', id) WHERE login = '' OR login IS NULL"
4 change_column :users, :login, :string, null: false
8 change_column :users, :login, :string, null: true