Creating a control panel infrastructure
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "tenants" ADD COLUMN "sms_settings_cache" JSONB;
|
||||
ALTER TABLE "tenants" ADD COLUMN "sms_synced_at" DATETIME;
|
||||
@@ -0,0 +1,49 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "sms_accounts" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"tenant_id" TEXT NOT NULL,
|
||||
"balance_rials" INTEGER NOT NULL DEFAULT 0,
|
||||
"price_per_part_rials" INTEGER NOT NULL DEFAULT 2500,
|
||||
"is_blocked" BOOLEAN NOT NULL DEFAULT false,
|
||||
"alert_critical_rials" INTEGER NOT NULL DEFAULT 10000,
|
||||
"alert_warning_rials" INTEGER NOT NULL DEFAULT 100000,
|
||||
"gateway_provider" TEXT,
|
||||
"melipayamak_user" TEXT,
|
||||
"melipayamak_password" TEXT,
|
||||
"melipayamak_from" TEXT,
|
||||
"panel_username" TEXT,
|
||||
"panel_password" TEXT,
|
||||
"panel_from" TEXT,
|
||||
"extra_settings" JSONB,
|
||||
"today_messages" INTEGER NOT NULL DEFAULT 0,
|
||||
"today_parts" INTEGER NOT NULL DEFAULT 0,
|
||||
"today_cost_rials" INTEGER NOT NULL DEFAULT 0,
|
||||
"month_messages" INTEGER NOT NULL DEFAULT 0,
|
||||
"month_parts" INTEGER NOT NULL DEFAULT 0,
|
||||
"month_cost_rials" INTEGER NOT NULL DEFAULT 0,
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" DATETIME NOT NULL,
|
||||
CONSTRAINT "sms_accounts_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "tenants" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "sms_ledgers" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"sms_account_id" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"amount_rials" INTEGER NOT NULL,
|
||||
"parts" INTEGER,
|
||||
"note" TEXT,
|
||||
"created_by_id" TEXT,
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "sms_ledgers_sms_account_id_fkey" FOREIGN KEY ("sms_account_id") REFERENCES "sms_accounts" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "sms_accounts_tenant_id_key" ON "sms_accounts"("tenant_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "sms_ledgers_sms_account_id_idx" ON "sms_ledgers"("sms_account_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "sms_ledgers_created_at_idx" ON "sms_ledgers"("created_at");
|
||||
Reference in New Issue
Block a user