stacker.news/prisma/migrations/20221110190205_msats_bigint/migration.sql

43 lines
1.2 KiB
MySQL
Raw Normal View History

2022-11-15 20:51:55 +00:00
-- AlterTable
ALTER TABLE "Earn" ALTER COLUMN "msats" SET DATA TYPE BIGINT;
-- AlterTable
ALTER TABLE "Invoice" ALTER COLUMN "msatsRequested" SET DATA TYPE BIGINT,
ALTER COLUMN "msatsReceived" SET DATA TYPE BIGINT;
-- AlterTable
ALTER TABLE "Item"
ALTER COLUMN "commentSats" SET DATA TYPE BIGINT,
ALTER COLUMN "sats" SET DATA TYPE BIGINT;
-- AlterTable
ALTER TABLE "Item" RENAME COLUMN "commentSats" TO "commentMsats";
ALTER TABLE "Item" RENAME COLUMN "sats" TO "msats";
-- update to msats
UPDATE "Item" SET
"commentMsats" = "commentMsats" * 1000,
"msats" = "msats" * 1000;
-- AlterTable
ALTER TABLE "ItemAct"
ALTER COLUMN "sats" SET DATA TYPE BIGINT;
-- AlterTable
ALTER TABLE "ItemAct" RENAME COLUMN "sats" TO "msats";
-- update to msats
UPDATE "ItemAct" SET
"msats" = "msats" * 1000;
-- AlterTable
ALTER TABLE "Withdrawl" ALTER COLUMN "msatsPaying" SET DATA TYPE BIGINT,
ALTER COLUMN "msatsPaid" SET DATA TYPE BIGINT,
ALTER COLUMN "msatsFeePaying" SET DATA TYPE BIGINT,
ALTER COLUMN "msatsFeePaid" SET DATA TYPE BIGINT;
-- AlterTable
ALTER TABLE "users" ALTER COLUMN "msats" SET DEFAULT 0,
ALTER COLUMN "msats" SET DATA TYPE BIGINT,
ALTER COLUMN "stackedMsats" SET DEFAULT 0,
ALTER COLUMN "stackedMsats" SET DATA TYPE BIGINT;