mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
451 B
23 lines
451 B
# frozen_string_literal: true
|
|
|
|
class AddUuidToUsers < ActiveRecord::Migration[7.0]
|
|
class MigrationUser < ApplicationRecord
|
|
self.table_name = 'users'
|
|
end
|
|
|
|
def up
|
|
add_column :users, :uuid, :string
|
|
add_index :users, :uuid, unique: true
|
|
|
|
MigrationUser.all.each do |user|
|
|
user.update_columns(uuid: SecureRandom.uuid)
|
|
end
|
|
|
|
change_column_null :users, :uuid, false
|
|
end
|
|
|
|
def down
|
|
drop_column :users, :uuid
|
|
end
|
|
end
|