Rename LNbits primary key column from 'int' to 'id' (#1321)

* Rename LNbits primary key column from 'int' to 'id'

* fix migration

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
This commit is contained in:
ekzyis 2024-08-21 10:49:48 -05:00 committed by GitHub
parent 789d7626f7
commit 67d71ef0c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,14 @@
/*
Warnings:
- The primary key for the `WalletLNbits` 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 `WalletLNbits` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "WalletLNbits" RENAME COLUMN "int" TO "id";
UPDATE "Wallet"
SET wallet = to_jsonb("WalletLNbits")
FROM "WalletLNbits"
WHERE "Wallet".id = "WalletLNbits"."walletId";

View File

@ -246,7 +246,7 @@ model WalletCLN {
}
model WalletLNbits {
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")