chore(db): add AppSetting model
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-- Manual migration to add AppSetting table
|
||||
-- This SQL is for SQLite and stores JSON in a TEXT column
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "AppSetting" (
|
||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
"key" TEXT NOT NULL UNIQUE,
|
||||
"value" TEXT NOT NULL,
|
||||
"description" TEXT,
|
||||
"updatedAt" DATETIME NOT NULL DEFAULT (CURRENT_TIMESTAMP),
|
||||
"updatedBy" TEXT
|
||||
);
|
||||
|
||||
-- Optional: trigger to update updatedAt on row update
|
||||
CREATE TRIGGER IF NOT EXISTS "AppSetting_updatedAt"
|
||||
AFTER UPDATE ON "AppSetting"
|
||||
BEGIN
|
||||
UPDATE "AppSetting" SET "updatedAt" = CURRENT_TIMESTAMP WHERE "id" = NEW."id";
|
||||
END;
|
||||
@@ -19,3 +19,12 @@ model Stock {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model AppSetting {
|
||||
id Int @id @default(autoincrement())
|
||||
key String @unique
|
||||
value Json
|
||||
description String?
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user