diff --git a/prisma/migrations/20220206171013_comment_field_removed/migration.sql b/prisma/migrations/20220206171013_comment_field_removed/migration.sql new file mode 100644 index 0000000..2d75752 --- /dev/null +++ b/prisma/migrations/20220206171013_comment_field_removed/migration.sql @@ -0,0 +1,23 @@ +/* + Warnings: + + - You are about to drop the column `comment` on the `Item` table. All the data in the column will be lost. + +*/ +-- RedefineTables +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_Item" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "title" TEXT NOT NULL, + "url" TEXT NOT NULL DEFAULT '', + "imageSrc" TEXT NOT NULL DEFAULT '', + "description" TEXT NOT NULL, + "bought" BOOLEAN NOT NULL DEFAULT false, + "wishlistId" TEXT NOT NULL, + CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE RESTRICT ON UPDATE CASCADE +); +INSERT INTO "new_Item" ("bought", "description", "id", "imageSrc", "title", "url", "wishlistId") SELECT "bought", "description", "id", "imageSrc", "title", "url", "wishlistId" FROM "Item"; +DROP TABLE "Item"; +ALTER TABLE "new_Item" RENAME TO "Item"; +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 492ab53..adb8d25 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -25,7 +25,6 @@ model Item { url String @default("") imageSrc String @default("") description String - comment String @default("") bought Boolean @default(false) wishlist Wishlist @relation(fields: [wishlistId], references: [id]) wishlistId String diff --git a/prisma/seed.ts b/prisma/seed.ts index b404659..b03b616 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -18,7 +18,6 @@ const wishlistData: Prisma.WishlistCreateInput[] = [ 'https://www.lego.com/cdn/cs/set/assets/blt1fc37afef51cfa9f/40442.jpg?fit=bounds&format=jpg&quality=80&width=1500&height=1500&dpr=1', description: 'Cute goldfish and fry, build-and-display BrickHeadz™ model', - comment: '', }, ], }, diff --git a/src/api/config/schemas/wishlist.ts b/src/api/config/schemas/wishlist.ts index 2bbdea3..06d7b63 100644 --- a/src/api/config/schemas/wishlist.ts +++ b/src/api/config/schemas/wishlist.ts @@ -7,7 +7,6 @@ export const wishlistItemRequestSchema = { url: { type: 'string' }, imageSrc: { type: 'string' }, description: { type: 'string' }, - comment: { type: 'string' }, bought: { type: 'boolean' }, }, } @@ -20,7 +19,6 @@ export const wishlistItemResponseSchema = { url: { type: 'string' }, imageSrc: { type: 'string' }, description: { type: 'string', maxLength: 300 }, - comment: { type: 'string' }, bought: { type: 'boolean' }, wishlistId: { type: 'string' }, }, diff --git a/src/components/WishlistItem.vue b/src/components/WishlistItem.vue index 0f0421d..c270197 100644 --- a/src/components/WishlistItem.vue +++ b/src/components/WishlistItem.vue @@ -9,7 +9,6 @@ defineProps<{ image: string url?: string description: string - comment?: string }>() const { t } = useI18n() diff --git a/src/types.ts b/src/types.ts index 9962ef6..7b0df49 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,7 +4,6 @@ export interface WishlistItem { url: string imageSrc: string description: string - comment: string bought: boolean wishlistId: boolean } diff --git a/src/views/DetailView.vue b/src/views/DetailView.vue index 73cf606..7429148 100644 --- a/src/views/DetailView.vue +++ b/src/views/DetailView.vue @@ -58,7 +58,6 @@ const bought = async (item: WishlistItemType): Promise => { :url="item.url" :image="item.imageSrc" :description="item.description" - :comment="item.comment" @bought="bought(item)" />