Login admin con cambio password, metriche server (CPU/RAM/disco/banda), grafici e statistiche streaming; sezione piani ridimensionata. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
652 B
Ruby
22 lines
652 B
Ruby
class CreateAdminAccounts < ActiveRecord::Migration[7.2]
|
|
def up
|
|
create_table :admin_accounts, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
|
t.string :username, null: false
|
|
t.string :password_digest, null: false
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :admin_accounts, :username, unique: true
|
|
|
|
password_digest = BCrypt::Password.create("admin")
|
|
execute <<~SQL.squish
|
|
INSERT INTO admin_accounts (id, username, password_digest, created_at, updated_at)
|
|
VALUES (gen_random_uuid(), 'admin', #{connection.quote(password_digest)}, NOW(), NOW())
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
drop_table :admin_accounts
|
|
end
|
|
end
|