added useMetadata and refactor user component

This commit is contained in:
Ren Amamiya
2023-04-06 09:25:18 +07:00
parent 3c63dece46
commit 5437ec5c92
17 changed files with 161 additions and 211 deletions

View File

@@ -0,0 +1,5 @@
-- DropIndex
DROP INDEX "Pleb_pubkey_idx";
-- DropIndex
DROP INDEX "Pleb_pubkey_key";

View File

@@ -0,0 +1,23 @@
/*
Warnings:
- Added the required column `plebId` to the `Pleb` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Pleb" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"plebId" TEXT NOT NULL,
"pubkey" TEXT NOT NULL,
"kind" INTEGER NOT NULL,
"metadata" TEXT NOT NULL,
"accountId" INTEGER NOT NULL,
CONSTRAINT "Pleb_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Pleb" ("accountId", "id", "kind", "metadata", "pubkey") SELECT "accountId", "id", "kind", "metadata", "pubkey" FROM "Pleb";
DROP TABLE "Pleb";
ALTER TABLE "new_Pleb" RENAME TO "Pleb";
CREATE UNIQUE INDEX "Pleb_plebId_key" ON "Pleb"("plebId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View File

@@ -27,14 +27,13 @@ model Account {
model Pleb {
id Int @id @default(autoincrement())
pubkey String @unique
plebId String @unique
pubkey String
kind Int
metadata String
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([pubkey])
}
model Note {