Files
heygermany-e2e-mrg2zk24/db/sqlite/0005-admin.sql
e2e 373b42a994
Some checks failed
Main / Setup and Test (push) Has been cancelled
Main / Build Website (push) Has been cancelled
chore: heygermany customer project
2026-07-11 10:06:51 +02:00

18 lines
1.0 KiB
SQL

-- =============================================================================
-- BETTER AUTH ADMIN PLUGIN — user administration
-- Adds the columns the Better Auth `admin()` plugin declares so its schema is
-- covered by an explicit migration and the db drift check passes. The plugin
-- exposes /api/auth/admin/* (listUsers, setRole, ban, impersonateUser, …);
-- `impersonated_by` marks a session created via "view as user" so it can be
-- reverted with admin.stopImpersonating. All fields are optional — a user with
-- `role` = 'admin' is an administrator; everyone else stays a normal user.
-- `role` already exists on auth_user (0001-baseline.sql additionalFields), so
-- only the admin-specific columns are added here.
-- =============================================================================
ALTER TABLE "auth_user" ADD COLUMN "banned" integer DEFAULT 0;
ALTER TABLE "auth_user" ADD COLUMN "ban_reason" text;
ALTER TABLE "auth_user" ADD COLUMN "ban_expires" date;
ALTER TABLE "auth_session" ADD COLUMN "impersonated_by" text;