Initial admin edits
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "AppBanner" ADD COLUMN "bannerLink" TEXT;
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Preserve customer ↔ company links where only CustomerBrand existed (match by brand/company name or slug)
|
||||
UPDATE "Customer" c
|
||||
SET "companyId" = comp.id
|
||||
FROM "CustomerBrand" cb
|
||||
JOIN "Brand" b ON b.id = cb."brandId"
|
||||
JOIN "Company" comp ON LOWER(TRIM(comp.name)) = LOWER(TRIM(b.name))
|
||||
WHERE cb."customerId" = c.id
|
||||
AND c."companyId" IS NULL;
|
||||
|
||||
UPDATE "Customer" c
|
||||
SET "companyId" = comp.id
|
||||
FROM "CustomerBrand" cb
|
||||
JOIN "Brand" b ON b.id = cb."brandId"
|
||||
JOIN "Company" comp ON b.slug IS NOT NULL AND comp.slug = b.slug
|
||||
WHERE cb."customerId" = c.id
|
||||
AND c."companyId" IS NULL;
|
||||
|
||||
ALTER TABLE "Product" DROP CONSTRAINT IF EXISTS "Product_brandId_fkey";
|
||||
DROP INDEX IF EXISTS "Product_brandId_idx";
|
||||
ALTER TABLE "Product" DROP COLUMN IF EXISTS "brandId";
|
||||
|
||||
DROP TABLE IF EXISTS "CustomerBrand";
|
||||
DROP TABLE IF EXISTS "Brand";
|
||||
@@ -0,0 +1,30 @@
|
||||
-- نادمی تکس: شرکت اصلی (دریافت پرداخت + پیشفرض محصولات بدون شرکت مشخص)
|
||||
INSERT INTO "Company" (
|
||||
"id",
|
||||
"name",
|
||||
"slug",
|
||||
"description",
|
||||
"isActive",
|
||||
"displayOrder",
|
||||
"cashInvoiceValidityHours",
|
||||
"updatedAt"
|
||||
)
|
||||
VALUES (
|
||||
'company-nademitex',
|
||||
'نادمی تکس',
|
||||
'nademitex',
|
||||
'شرکت اصلی — تمام پرداختهای اپ به حسابهای این شرکت واریز میشود',
|
||||
true,
|
||||
0,
|
||||
8,
|
||||
CURRENT_TIMESTAMP
|
||||
)
|
||||
ON CONFLICT ("slug") DO UPDATE SET
|
||||
"name" = EXCLUDED."name",
|
||||
"description" = EXCLUDED."description",
|
||||
"isActive" = true;
|
||||
|
||||
-- حسابهای بانکی فقط برای دریافت پرداخت نادمی تکس
|
||||
UPDATE "BankAccount"
|
||||
SET "companyId" = (SELECT "id" FROM "Company" WHERE "slug" = 'nademitex' LIMIT 1)
|
||||
WHERE "companyId" IS NOT NULL;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Product" ADD COLUMN "specs" TEXT;
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "SystemSettings" ADD COLUMN "supportWhatsapp" TEXT;
|
||||
ALTER TABLE "SystemSettings" ADD COLUMN "supportTelegram" TEXT;
|
||||
ALTER TABLE "SystemSettings" ADD COLUMN "supportInstagram" TEXT;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "SettlementType" ADD VALUE 'cash_check';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "SystemSettings" ADD COLUMN "defaultSettlementCashCheck" BOOLEAN NOT NULL DEFAULT false;
|
||||
Reference in New Issue
Block a user