add submitters api

This commit is contained in:
Alex Turchyn
2023-08-04 00:40:13 +03:00
parent 63e1246a11
commit 7912c9a1ee
16 changed files with 177 additions and 35 deletions
@@ -0,0 +1,22 @@
# frozen_string_literal: true
class AddUuidToUsers < ActiveRecord::Migration[7.0]
class MigrationUser < ApplicationRecord
self.table_name = 'users'
end
def up
add_column :users, :uuid, :text
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
+3 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_07_26_062428) do
ActiveRecord::Schema[7.0].define(version: 2023_08_03_200825) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -139,10 +139,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_26_062428) do
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "uuid", null: false
t.index ["account_id"], name: "index_users_on_account_id"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
t.index ["uuid"], name: "index_users_on_uuid", unique: true
end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"