Add production-ready SuperAdmin API features for tenants, SMS, servers, and plugins.
Includes mobile auth, get_user/get_version, SMS wallet parity endpoints, appearance backfill, and related Prisma migrations. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
-- Rebuild users for mobile login (SQLite)
|
||||
PRAGMA foreign_keys=OFF;
|
||||
|
||||
CREATE TABLE "users_new" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"mobile" TEXT NOT NULL,
|
||||
"first_name" TEXT NOT NULL,
|
||||
"last_name" TEXT NOT NULL,
|
||||
"email" TEXT,
|
||||
"password_hash" TEXT NOT NULL,
|
||||
"role" TEXT NOT NULL DEFAULT 'super_admin',
|
||||
"is_active" BOOLEAN NOT NULL DEFAULT true,
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" DATETIME NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO "users_new" (
|
||||
"id", "mobile", "first_name", "last_name", "email",
|
||||
"password_hash", "role", "is_active", "created_at", "updated_at"
|
||||
)
|
||||
SELECT
|
||||
"id",
|
||||
CASE
|
||||
WHEN "email" = 'admin@abshode.local' THEN '09128081392'
|
||||
ELSE printf('09%09d', abs(random()) % 1000000000)
|
||||
END,
|
||||
CASE
|
||||
WHEN instr("name", ' ') > 0 THEN substr("name", 1, instr("name", ' ') - 1)
|
||||
ELSE "name"
|
||||
END,
|
||||
CASE
|
||||
WHEN instr("name", ' ') > 0 THEN substr("name", instr("name", ' ') + 1)
|
||||
ELSE ''
|
||||
END,
|
||||
"email",
|
||||
"password_hash",
|
||||
"role",
|
||||
"is_active",
|
||||
"created_at",
|
||||
"updated_at"
|
||||
FROM "users";
|
||||
|
||||
DROP TABLE "users";
|
||||
ALTER TABLE "users_new" RENAME TO "users";
|
||||
|
||||
CREATE UNIQUE INDEX "users_mobile_key" ON "users"("mobile");
|
||||
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
||||
|
||||
PRAGMA foreign_keys=ON;
|
||||
Reference in New Issue
Block a user