You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
472 B

-- AlterTable
ALTER TABLE "SymbolProfile" ADD COLUMN "userId" TEXT;
-- AddForeignKey
ALTER TABLE "SymbolProfile" ADD CONSTRAINT "SymbolProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- Set userIds in SymbolProfile for 'MANUAL' data source
UPDATE "SymbolProfile"
SET "userId" = (
SELECT "userId"
FROM "Order"
WHERE "Order"."symbolProfileId" = "SymbolProfile"."id"
LIMIT 1
)
WHERE "dataSource" = 'MANUAL';