Rename NWC primary key column from 'int' to 'id' (#1328)
This commit is contained in:
parent
66cf97e832
commit
c0de29cb82
15
prisma/migrations/20240823045403_rename_nwc_pk/migration.sql
Normal file
15
prisma/migrations/20240823045403_rename_nwc_pk/migration.sql
Normal 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";
|
@ -256,7 +256,7 @@ model WalletLNbits {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model WalletNWC {
|
model WalletNWC {
|
||||||
int Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
walletId Int @unique
|
walletId Int @unique
|
||||||
wallet Wallet @relation(fields: [walletId], references: [id], onDelete: Cascade)
|
wallet Wallet @relation(fields: [walletId], references: [id], onDelete: Cascade)
|
||||||
createdAt DateTime @default(now()) @map("created_at")
|
createdAt DateTime @default(now()) @map("created_at")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user