Admin protetto, dashboard KPI e aggiornamenti sito marketing.
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>
This commit is contained in:
21
backend/db/migrate/20260527130000_create_admin_accounts.rb
Normal file
21
backend/db/migrate/20260527130000_create_admin_accounts.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
Reference in New Issue
Block a user