From 1e5c575e16c8a9e6bd7592e83bea53af7f359e15 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Sun, 6 Oct 2024 14:33:40 +0000
Subject: refactor: Start tracking bookmark assets in the assets table

---
 packages/db/drizzle/0030_blue_synch.sql | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 packages/db/drizzle/0030_blue_synch.sql

(limited to 'packages/db/drizzle/0030_blue_synch.sql')

diff --git a/packages/db/drizzle/0030_blue_synch.sql b/packages/db/drizzle/0030_blue_synch.sql
new file mode 100644
index 00000000..9b1bac33
--- /dev/null
+++ b/packages/db/drizzle/0030_blue_synch.sql
@@ -0,0 +1,12 @@
+ALTER TABLE `assets` ADD `size` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
+ALTER TABLE `assets` ADD `contentType` text;--> statement-breakpoint
+ALTER TABLE `assets` ADD `fileName` text;--> statement-breakpoint
+INSERT INTO `assets` (`id`, `assetType`, `bookmarkId`, `userId`, `fileName`)
+	SELECT
+		`bookmarkAssets`.`assetId`,
+		'bookmarkAsset',
+		`bookmarkAssets`.`id`,
+		(SELECT `bookmarks`.`userId` FROM `bookmarks` WHERE `bookmarks`.`id` = `bookmarkAssets`.`id`),
+		`bookmarkAssets`.`fileName`
+	FROM `bookmarkAssets`;
+
-- 
cgit v1.2.3-70-g09d2

