Rename NWC primary key column from 'int' to 'id' (#1328)

This commit is contained in:
ekzyis 2024-08-23 10:11:13 -05:00 committed by GitHub
parent 66cf97e832
commit c0de29cb82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,15 @@
/*
Warnings:
- The primary key for the `WalletNWC` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `int` on the `WalletNWC` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "WalletNWC" RENAME COLUMN "int" TO "id";
UPDATE "Wallet"
SET wallet = to_jsonb("WalletNWC")
FROM "WalletNWC"
WHERE "Wallet".id = "WalletNWC"."walletId";

View File

@ -256,7 +256,7 @@ model WalletLNbits {
}
model WalletNWC {
int Int @id @default(autoincrement())
id Int @id @default(autoincrement())
walletId Int @unique
wallet Wallet @relation(fields: [walletId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now()) @map("created_at")