@s-hirano-ist/s-database 1.19.1 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/package.json +4 -5
  2. package/prisma/migrations/0_init/migration.sql +107 -0
  3. package/prisma/migrations/1_better_auth/migration.sql +69 -0
  4. package/prisma/migrations/migration_lock.toml +1 -1
  5. package/prisma/remap-userids-better-auth.sql +98 -0
  6. package/prisma/schema.prisma +116 -35
  7. package/src/generated/edge.js +56 -8
  8. package/src/generated/index-browser.js +51 -3
  9. package/src/generated/index.d.ts +6191 -35
  10. package/src/generated/index.js +56 -8
  11. package/src/generated/package.json +1 -1
  12. package/src/generated/query_compiler_fast_bg.wasm +0 -0
  13. package/src/generated/query_compiler_fast_bg.wasm-base64.js +1 -1
  14. package/src/generated/schema.prisma +116 -35
  15. package/src/index.ts +63 -7
  16. package/prisma/migrations/20241005070905_initial_with_user/migration.sql +0 -105
  17. package/prisma/migrations/20241005122052_category_unique_name/migration.sql +0 -11
  18. package/prisma/migrations/20241006114119_add_role/migration.sql +0 -5
  19. package/prisma/migrations/20241011230910_add_scope_and_username/migration.sql +0 -24
  20. package/prisma/migrations/20241012012914_migrate_user_verified_to_role/migration.sql +0 -11
  21. package/prisma/migrations/20241012014828_delete_user_email/migration.sql +0 -11
  22. package/prisma/migrations/20241013122009_delete_unique_on_profile_name/migration.sql +0 -2
  23. package/prisma/migrations/20241113115839_add_image_table/migration.sql +0 -13
  24. package/prisma/migrations/20241116050545_login_lock/migration.sql +0 -3
  25. package/prisma/migrations/20250104003943_delete_user_scope_column/migration.sql +0 -11
  26. package/prisma/migrations/20250104031930_delete_unauthorized_role_enum/migration.sql +0 -16
  27. package/prisma/migrations/20250104033736_change_user_role_enum_name/migration.sql +0 -19
  28. package/prisma/migrations/20250104064405_add_static_books_and_contents/migration.sql +0 -27
  29. package/prisma/migrations/20250113084254_drop_user_table/migration.sql +0 -37
  30. package/prisma/migrations/20250118084244_add_image_metadata/migration.sql +0 -14
  31. package/prisma/migrations/20250129231002_add_static_image_table/migration.sql +0 -14
  32. package/prisma/migrations/20250504020635_add_static_news_table/migration.sql +0 -27
  33. package/prisma/migrations/20250510025039_fix_no_unique_for_categories/migration.sql +0 -2
  34. package/prisma/migrations/20250614000736_add_google_api_data/migration.sql +0 -31
  35. package/prisma/migrations/20250719061839_add_og_for_static_news/migration.sql +0 -4
  36. package/prisma/migrations/20250730114244_delete_uint8arrayimage_from_static_books/migration.sql +0 -8
  37. package/prisma/migrations/20250811111733_delete_static_news/migration.sql +0 -20
  38. package/prisma/migrations/20250811115459_delete_updated_recently/migration.sql +0 -34
  39. package/prisma/migrations/20250811131348_merge_viewer_to_dumper/migration.sql +0 -54
  40. package/prisma/migrations/20250812234654_add_unique_costraints_on_unique_key/migration.sql +0 -19
  41. package/prisma/migrations/20250813033448_add_unique_constraints_on_images/migration.sql +0 -8
  42. package/prisma/migrations/20250813085846_delete_single_unique_constraints/migration.sql +0 -5
  43. package/prisma/migrations/20250813140904_change_id_from_int_to_uuid/migration.sql +0 -27
  44. package/prisma/migrations/20250813141347_move_image_id_to_paths/migration.sql +0 -15
  45. package/prisma/migrations/20250815002544_change_default_values/migration.sql +0 -39
  46. package/prisma/migrations/20250815040824_rename_images_paths_to_path/migration.sql +0 -17
  47. package/prisma/migrations/20250818232331_change_news_contents_to_article_note/migration.sql +0 -57
  48. package/prisma/migrations/20250819024722_delete_default_now_for_created_at/migration.sql +0 -14
  49. package/prisma/migrations/20251214044139_add_last_updated_to_status_schema/migration.sql +0 -2
  50. package/prisma/migrations/20260104035357_add_image_paths_for_book_dumper/migration.sql +0 -2
  51. package/prisma/migrations/20260118120015_add_schema_restrictions_on_cols/migration.sql +0 -93
  52. package/prisma/migrations/20260125055037_remove_image_tags_description/migration.sql +0 -10
  53. package/prisma/migrations/20260214022211_add_more_url_length_to_og_image/migration.sql +0 -2
  54. package/prisma/migrations/20260418090234_rating_to_required/migration.sql +0 -8
  55. package/prisma/migrations/20260419000000_merge_google_title_into_title/migration.sql +0 -15
@@ -1,27 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[name]` on the table `categories` will be added. If there are existing duplicate values, this will fail.
5
-
6
- */
7
- -- CreateTable
8
- CREATE TABLE "st_news" (
9
- "id" SERIAL NOT NULL,
10
- "url" TEXT NOT NULL,
11
- "title" TEXT NOT NULL,
12
- "quote" TEXT,
13
- "category_id" INTEGER NOT NULL,
14
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
15
- "updated_at" TIMESTAMP(3) NOT NULL,
16
-
17
- CONSTRAINT "st_news_pkey" PRIMARY KEY ("url")
18
- );
19
-
20
- -- CreateIndex
21
- CREATE UNIQUE INDEX "st_news_url_key" ON "st_news"("url");
22
-
23
- -- CreateIndex
24
- CREATE UNIQUE INDEX "categories_name_key" ON "categories"("name");
25
-
26
- -- AddForeignKey
27
- ALTER TABLE "st_news" ADD CONSTRAINT "st_news_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "categories"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,2 +0,0 @@
1
- -- DropIndex
2
- DROP INDEX "categories_name_key";
@@ -1,31 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - The primary key for the `st_books` table will be changed. If it partially fails, the table could be left without primary key constraint.
5
- - A unique constraint covering the columns `[isbn]` on the table `st_books` will be added. If there are existing duplicate values, this will fail.
6
- - Added the required column `google_description` to the `st_books` table without a default value. This is not possible if the table is not empty.
7
- - Added the required column `google_href` to the `st_books` table without a default value. This is not possible if the table is not empty.
8
- - Added the required column `google_img_src` to the `st_books` table without a default value. This is not possible if the table is not empty.
9
- - Added the required column `google_subtitle` to the `st_books` table without a default value. This is not possible if the table is not empty.
10
- - Added the required column `google_title` to the `st_books` table without a default value. This is not possible if the table is not empty.
11
- - Added the required column `isbn` to the `st_books` table without a default value. This is not possible if the table is not empty.
12
-
13
- */
14
- -- DropIndex
15
- DROP INDEX "st_books_title_key";
16
-
17
- -- AlterTable
18
- ALTER TABLE "st_books" DROP CONSTRAINT "st_books_pkey",
19
- ADD COLUMN "google_authors" TEXT[],
20
- ADD COLUMN "google_description" TEXT NOT NULL,
21
- ADD COLUMN "google_href" TEXT NOT NULL,
22
- ADD COLUMN "google_img_src" TEXT NOT NULL,
23
- ADD COLUMN "google_subtitle" TEXT NOT NULL,
24
- ADD COLUMN "google_title" TEXT NOT NULL,
25
- ADD COLUMN "isbn" TEXT NOT NULL,
26
- ADD COLUMN "rating" INTEGER,
27
- ADD COLUMN "tags" TEXT[] DEFAULT ARRAY[]::TEXT[],
28
- ADD CONSTRAINT "st_books_pkey" PRIMARY KEY ("isbn");
29
-
30
- -- CreateIndex
31
- CREATE UNIQUE INDEX "st_books_isbn_key" ON "st_books"("isbn");
@@ -1,4 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "st_news" ADD COLUMN "og_description" TEXT,
3
- ADD COLUMN "og_image_url" TEXT,
4
- ADD COLUMN "og_title" TEXT;
@@ -1,8 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `uint8ArrayImage` on the `st_books` table. All the data in the column will be lost.
5
-
6
- */
7
- -- AlterTable
8
- ALTER TABLE "public"."st_books" DROP COLUMN "uint8ArrayImage";
@@ -1,20 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the `st_news` table. If the table is not empty, all the data it contains will be lost.
5
- - A unique constraint covering the columns `[url]` on the table `news` will be added. If there are existing duplicate values, this will fail.
6
-
7
- */
8
- -- DropForeignKey
9
- ALTER TABLE "public"."st_news" DROP CONSTRAINT "st_news_category_id_fkey";
10
-
11
- -- AlterTable
12
- ALTER TABLE "public"."news" ADD COLUMN "og_description" TEXT,
13
- ADD COLUMN "og_image_url" TEXT,
14
- ADD COLUMN "og_title" TEXT;
15
-
16
- -- DropTable
17
- DROP TABLE "public"."st_news";
18
-
19
- -- CreateIndex
20
- CREATE UNIQUE INDEX "news_url_key" ON "public"."news"("url");
@@ -1,34 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - The values [UPDATED_RECENTLY] on the enum `Status` will be removed. If these variants are still used in the database, this will fail.
5
- - You are about to drop the column `deleted_at` on the `images` table. All the data in the column will be lost.
6
- - You are about to drop the column `userId` on the `news` table. All the data in the column will be lost.
7
- - Added the required column `user_id` to the `news` table without a default value. This is not possible if the table is not empty.
8
-
9
- */
10
- -- AlterEnum
11
- BEGIN;
12
- CREATE TYPE "public"."Status_new" AS ENUM ('UNEXPORTED', 'EXPORTED');
13
- ALTER TABLE "public"."contents" ALTER COLUMN "status" DROP DEFAULT;
14
- ALTER TABLE "public"."images" ALTER COLUMN "status" DROP DEFAULT;
15
- ALTER TABLE "public"."news" ALTER COLUMN "status" DROP DEFAULT;
16
- ALTER TABLE "public"."news" ALTER COLUMN "status" TYPE "public"."Status_new" USING ("status"::text::"public"."Status_new");
17
- ALTER TABLE "public"."contents" ALTER COLUMN "status" TYPE "public"."Status_new" USING ("status"::text::"public"."Status_new");
18
- ALTER TABLE "public"."images" ALTER COLUMN "status" TYPE "public"."Status_new" USING ("status"::text::"public"."Status_new");
19
- ALTER TYPE "public"."Status" RENAME TO "Status_old";
20
- ALTER TYPE "public"."Status_new" RENAME TO "Status";
21
- DROP TYPE "public"."Status_old";
22
- ALTER TABLE "public"."contents" ALTER COLUMN "status" SET DEFAULT 'UNEXPORTED';
23
- ALTER TABLE "public"."images" ALTER COLUMN "status" SET DEFAULT 'UNEXPORTED';
24
- ALTER TABLE "public"."news" ALTER COLUMN "status" SET DEFAULT 'UNEXPORTED';
25
- COMMIT;
26
-
27
- -- AlterTable
28
- ALTER TABLE "public"."images" DROP COLUMN "deleted_at",
29
- ADD COLUMN "exported_at" TIMESTAMP(3);
30
-
31
- -- AlterTable
32
- ALTER TABLE "public"."news" DROP COLUMN "userId",
33
- ADD COLUMN "exported_at" TIMESTAMP(3),
34
- ADD COLUMN "user_id" TEXT NOT NULL;
@@ -1,54 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `quote` on the `contents` table. All the data in the column will be lost.
5
- - You are about to drop the column `url` on the `contents` table. All the data in the column will be lost.
6
- - You are about to drop the `st_books` table. If the table is not empty, all the data it contains will be lost.
7
- - You are about to drop the `st_contents` table. If the table is not empty, all the data it contains will be lost.
8
- - You are about to drop the `st_images` table. If the table is not empty, all the data it contains will be lost.
9
- - A unique constraint covering the columns `[title]` on the table `contents` will be added. If there are existing duplicate values, this will fail.
10
- - Added the required column `markdown` to the `contents` table without a default value. This is not possible if the table is not empty.
11
-
12
- */
13
- -- AlterTable
14
- ALTER TABLE "public"."contents" DROP COLUMN "quote",
15
- DROP COLUMN "url",
16
- ADD COLUMN "exported_at" TIMESTAMP(3),
17
- ADD COLUMN "markdown" TEXT NOT NULL;
18
-
19
- -- DropTable
20
- DROP TABLE "public"."st_books";
21
-
22
- -- DropTable
23
- DROP TABLE "public"."st_contents";
24
-
25
- -- DropTable
26
- DROP TABLE "public"."st_images";
27
-
28
- -- CreateTable
29
- CREATE TABLE "public"."books" (
30
- "isbn" TEXT NOT NULL,
31
- "title" TEXT NOT NULL,
32
- "google_title" TEXT NOT NULL,
33
- "google_subtitle" TEXT NOT NULL,
34
- "google_authors" TEXT[],
35
- "google_description" TEXT NOT NULL,
36
- "google_img_src" TEXT NOT NULL,
37
- "google_href" TEXT NOT NULL,
38
- "markdown" TEXT NOT NULL,
39
- "rating" INTEGER,
40
- "tags" TEXT[] DEFAULT ARRAY[]::TEXT[],
41
- "status" "public"."Status" NOT NULL DEFAULT 'UNEXPORTED',
42
- "user_id" TEXT NOT NULL,
43
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
44
- "updated_at" TIMESTAMP(3) NOT NULL,
45
- "exported_at" TIMESTAMP(3),
46
-
47
- CONSTRAINT "books_pkey" PRIMARY KEY ("isbn")
48
- );
49
-
50
- -- CreateIndex
51
- CREATE UNIQUE INDEX "books_isbn_key" ON "public"."books"("isbn");
52
-
53
- -- CreateIndex
54
- CREATE UNIQUE INDEX "contents_title_key" ON "public"."contents"("title");
@@ -1,19 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[isbn,user_id]` on the table `books` will be added. If there are existing duplicate values, this will fail.
5
- - A unique constraint covering the columns `[title,user_id]` on the table `contents` will be added. If there are existing duplicate values, this will fail.
6
- - A unique constraint covering the columns `[url,user_id]` on the table `news` will be added. If there are existing duplicate values, this will fail.
7
-
8
- */
9
- -- DropIndex
10
- DROP INDEX "public"."news_url_key";
11
-
12
- -- CreateIndex
13
- CREATE UNIQUE INDEX "books_isbn_user_id_key" ON "public"."books"("isbn", "user_id");
14
-
15
- -- CreateIndex
16
- CREATE UNIQUE INDEX "contents_title_user_id_key" ON "public"."contents"("title", "user_id");
17
-
18
- -- CreateIndex
19
- CREATE UNIQUE INDEX "news_url_user_id_key" ON "public"."news"("url", "user_id");
@@ -1,8 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[id,user_id]` on the table `images` will be added. If there are existing duplicate values, this will fail.
5
-
6
- */
7
- -- CreateIndex
8
- CREATE UNIQUE INDEX "images_id_user_id_key" ON "public"."images"("id", "user_id");
@@ -1,5 +0,0 @@
1
- -- DropIndex
2
- DROP INDEX "public"."books_isbn_key";
3
-
4
- -- DropIndex
5
- DROP INDEX "public"."contents_title_key";
@@ -1,27 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - The primary key for the `books` table will be changed. If it partially fails, the table could be left without primary key constraint.
5
- - The primary key for the `contents` table will be changed. If it partially fails, the table could be left without primary key constraint.
6
- - The primary key for the `news` table will be changed. If it partially fails, the table could be left without primary key constraint.
7
- - The required column `id` was added to the `books` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
8
-
9
- */
10
- -- AlterTable
11
- ALTER TABLE "public"."books" DROP CONSTRAINT "books_pkey",
12
- ADD COLUMN "id" TEXT NOT NULL,
13
- ADD CONSTRAINT "books_pkey" PRIMARY KEY ("id");
14
-
15
- -- AlterTable
16
- ALTER TABLE "public"."contents" DROP CONSTRAINT "contents_pkey",
17
- ALTER COLUMN "id" DROP DEFAULT,
18
- ALTER COLUMN "id" SET DATA TYPE TEXT,
19
- ADD CONSTRAINT "contents_pkey" PRIMARY KEY ("id");
20
- DROP SEQUENCE "contents_id_seq";
21
-
22
- -- AlterTable
23
- ALTER TABLE "public"."news" DROP CONSTRAINT "news_pkey",
24
- ALTER COLUMN "id" DROP DEFAULT,
25
- ALTER COLUMN "id" SET DATA TYPE TEXT,
26
- ADD CONSTRAINT "news_pkey" PRIMARY KEY ("id");
27
- DROP SEQUENCE "news_id_seq";
@@ -1,15 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[paths,user_id]` on the table `images` will be added. If there are existing duplicate values, this will fail.
5
- - Added the required column `paths` to the `images` table without a default value. This is not possible if the table is not empty.
6
-
7
- */
8
- -- DropIndex
9
- DROP INDEX "public"."images_id_user_id_key";
10
-
11
- -- AlterTable
12
- ALTER TABLE "public"."images" ADD COLUMN "paths" TEXT NOT NULL;
13
-
14
- -- CreateIndex
15
- CREATE UNIQUE INDEX "images_paths_user_id_key" ON "public"."images"("paths", "user_id");
@@ -1,39 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - The primary key for the `categories` table will be changed. If it partially fails, the table could be left without primary key constraint.
5
-
6
- */
7
- -- DropForeignKey
8
- ALTER TABLE "public"."news" DROP CONSTRAINT "news_category_id_fkey";
9
-
10
- -- AlterTable
11
- ALTER TABLE "public"."books" ALTER COLUMN "google_title" DROP NOT NULL,
12
- ALTER COLUMN "google_subtitle" DROP NOT NULL,
13
- ALTER COLUMN "google_description" DROP NOT NULL,
14
- ALTER COLUMN "google_img_src" DROP NOT NULL,
15
- ALTER COLUMN "google_href" DROP NOT NULL,
16
- ALTER COLUMN "markdown" DROP NOT NULL,
17
- ALTER COLUMN "tags" DROP DEFAULT,
18
- ALTER COLUMN "status" DROP DEFAULT;
19
-
20
- -- AlterTable
21
- ALTER TABLE "public"."categories" DROP CONSTRAINT "categories_pkey",
22
- ALTER COLUMN "id" DROP DEFAULT,
23
- ALTER COLUMN "id" SET DATA TYPE TEXT,
24
- ADD CONSTRAINT "categories_pkey" PRIMARY KEY ("id");
25
- DROP SEQUENCE "categories_id_seq";
26
-
27
- -- AlterTable
28
- ALTER TABLE "public"."contents" ALTER COLUMN "status" DROP DEFAULT;
29
-
30
- -- AlterTable
31
- ALTER TABLE "public"."images" ALTER COLUMN "status" DROP DEFAULT,
32
- ALTER COLUMN "tags" DROP DEFAULT;
33
-
34
- -- AlterTable
35
- ALTER TABLE "public"."news" ALTER COLUMN "status" DROP DEFAULT,
36
- ALTER COLUMN "category_id" SET DATA TYPE TEXT;
37
-
38
- -- AddForeignKey
39
- ALTER TABLE "public"."news" ADD CONSTRAINT "news_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,17 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `paths` on the `images` table. All the data in the column will be lost.
5
- - A unique constraint covering the columns `[path,user_id]` on the table `images` will be added. If there are existing duplicate values, this will fail.
6
- - Added the required column `path` to the `images` table without a default value. This is not possible if the table is not empty.
7
-
8
- */
9
- -- DropIndex
10
- DROP INDEX "public"."images_paths_user_id_key";
11
-
12
- -- AlterTable
13
- ALTER TABLE "public"."images" DROP COLUMN "paths",
14
- ADD COLUMN "path" TEXT NOT NULL;
15
-
16
- -- CreateIndex
17
- CREATE UNIQUE INDEX "images_path_user_id_key" ON "public"."images"("path", "user_id");
@@ -1,57 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the `contents` table. If the table is not empty, all the data it contains will be lost.
5
- - You are about to drop the `news` table. If the table is not empty, all the data it contains will be lost.
6
-
7
- */
8
- -- DropForeignKey
9
- ALTER TABLE "public"."news" DROP CONSTRAINT "news_category_id_fkey";
10
-
11
- -- DropTable
12
- DROP TABLE "public"."contents";
13
-
14
- -- DropTable
15
- DROP TABLE "public"."news";
16
-
17
- -- CreateTable
18
- CREATE TABLE "public"."articles" (
19
- "id" TEXT NOT NULL,
20
- "title" TEXT NOT NULL,
21
- "url" TEXT NOT NULL,
22
- "quote" TEXT,
23
- "og_image_url" TEXT,
24
- "og_title" TEXT,
25
- "og_description" TEXT,
26
- "category_id" TEXT NOT NULL,
27
- "status" "public"."Status" NOT NULL,
28
- "user_id" TEXT NOT NULL,
29
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
30
- "updated_at" TIMESTAMP(3) NOT NULL,
31
- "exported_at" TIMESTAMP(3),
32
-
33
- CONSTRAINT "articles_pkey" PRIMARY KEY ("id")
34
- );
35
-
36
- -- CreateTable
37
- CREATE TABLE "public"."notes" (
38
- "id" TEXT NOT NULL,
39
- "title" TEXT NOT NULL,
40
- "markdown" TEXT NOT NULL,
41
- "status" "public"."Status" NOT NULL,
42
- "user_id" TEXT NOT NULL,
43
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
44
- "updated_at" TIMESTAMP(3) NOT NULL,
45
- "exported_at" TIMESTAMP(3),
46
-
47
- CONSTRAINT "notes_pkey" PRIMARY KEY ("id")
48
- );
49
-
50
- -- CreateIndex
51
- CREATE UNIQUE INDEX "articles_url_user_id_key" ON "public"."articles"("url", "user_id");
52
-
53
- -- CreateIndex
54
- CREATE UNIQUE INDEX "notes_title_user_id_key" ON "public"."notes"("title", "user_id");
55
-
56
- -- AddForeignKey
57
- ALTER TABLE "public"."articles" ADD CONSTRAINT "articles_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,14 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "public"."articles" ALTER COLUMN "created_at" DROP DEFAULT;
3
-
4
- -- AlterTable
5
- ALTER TABLE "public"."books" ALTER COLUMN "created_at" DROP DEFAULT;
6
-
7
- -- AlterTable
8
- ALTER TABLE "public"."categories" ALTER COLUMN "created_at" DROP DEFAULT;
9
-
10
- -- AlterTable
11
- ALTER TABLE "public"."images" ALTER COLUMN "created_at" DROP DEFAULT;
12
-
13
- -- AlterTable
14
- ALTER TABLE "public"."notes" ALTER COLUMN "created_at" DROP DEFAULT;
@@ -1,2 +0,0 @@
1
- -- AlterEnum
2
- ALTER TYPE "Status" ADD VALUE 'LAST_UPDATED';
@@ -1,2 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "books" ADD COLUMN "image_path" TEXT;
@@ -1,93 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - The primary key for the `articles` table will be changed. If it partially fails, the table could be left without primary key constraint.
5
- - You are about to alter the column `id` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(36)`.
6
- - You are about to alter the column `title` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(128)`.
7
- - You are about to alter the column `url` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(2048)`.
8
- - You are about to alter the column `quote` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(512)`.
9
- - You are about to alter the column `og_image_url` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(2048)`.
10
- - You are about to alter the column `og_title` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(512)`.
11
- - You are about to alter the column `og_description` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(1024)`.
12
- - You are about to alter the column `category_id` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(36)`.
13
- - You are about to alter the column `user_id` on the `articles` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(128)`.
14
- - The primary key for the `books` table will be changed. If it partially fails, the table could be left without primary key constraint.
15
- - You are about to alter the column `isbn` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(17)`.
16
- - You are about to alter the column `title` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(256)`.
17
- - You are about to alter the column `google_title` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(512)`.
18
- - You are about to alter the column `google_subtitle` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(512)`.
19
- - You are about to alter the column `google_img_src` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(2048)`.
20
- - You are about to alter the column `google_href` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(2048)`.
21
- - You are about to alter the column `user_id` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(128)`.
22
- - You are about to alter the column `id` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(36)`.
23
- - You are about to alter the column `image_path` on the `books` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(512)`.
24
- - The primary key for the `categories` table will be changed. If it partially fails, the table could be left without primary key constraint.
25
- - You are about to alter the column `id` on the `categories` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(36)`.
26
- - You are about to alter the column `name` on the `categories` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(16)`.
27
- - You are about to alter the column `user_id` on the `categories` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(128)`.
28
- - The primary key for the `images` table will be changed. If it partially fails, the table could be left without primary key constraint.
29
- - You are about to alter the column `id` on the `images` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(36)`.
30
- - You are about to alter the column `user_id` on the `images` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(128)`.
31
- - You are about to alter the column `content_type` on the `images` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(32)`.
32
- - You are about to alter the column `description` on the `images` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(1024)`.
33
- - You are about to alter the column `path` on the `images` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(512)`.
34
- - The primary key for the `notes` table will be changed. If it partially fails, the table could be left without primary key constraint.
35
- - You are about to alter the column `id` on the `notes` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(36)`.
36
- - You are about to alter the column `title` on the `notes` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(64)`.
37
- - You are about to alter the column `user_id` on the `notes` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(128)`.
38
-
39
- */
40
- -- DropForeignKey
41
- ALTER TABLE "articles" DROP CONSTRAINT "articles_category_id_fkey";
42
-
43
- -- AlterTable
44
- ALTER TABLE "articles" DROP CONSTRAINT "articles_pkey",
45
- ALTER COLUMN "id" SET DATA TYPE VARCHAR(36),
46
- ALTER COLUMN "title" SET DATA TYPE VARCHAR(128),
47
- ALTER COLUMN "url" SET DATA TYPE VARCHAR(2048),
48
- ALTER COLUMN "quote" SET DATA TYPE VARCHAR(512),
49
- ALTER COLUMN "og_image_url" SET DATA TYPE VARCHAR(2048),
50
- ALTER COLUMN "og_title" SET DATA TYPE VARCHAR(512),
51
- ALTER COLUMN "og_description" SET DATA TYPE VARCHAR(1024),
52
- ALTER COLUMN "category_id" SET DATA TYPE VARCHAR(36),
53
- ALTER COLUMN "user_id" SET DATA TYPE VARCHAR(128),
54
- ADD CONSTRAINT "articles_pkey" PRIMARY KEY ("id");
55
-
56
- -- AlterTable
57
- ALTER TABLE "books" DROP CONSTRAINT "books_pkey",
58
- ALTER COLUMN "isbn" SET DATA TYPE VARCHAR(17),
59
- ALTER COLUMN "title" SET DATA TYPE VARCHAR(256),
60
- ALTER COLUMN "google_title" SET DATA TYPE VARCHAR(512),
61
- ALTER COLUMN "google_subtitle" SET DATA TYPE VARCHAR(512),
62
- ALTER COLUMN "google_img_src" SET DATA TYPE VARCHAR(2048),
63
- ALTER COLUMN "google_href" SET DATA TYPE VARCHAR(2048),
64
- ALTER COLUMN "user_id" SET DATA TYPE VARCHAR(128),
65
- ALTER COLUMN "id" SET DATA TYPE VARCHAR(36),
66
- ALTER COLUMN "image_path" SET DATA TYPE VARCHAR(512),
67
- ADD CONSTRAINT "books_pkey" PRIMARY KEY ("id");
68
-
69
- -- AlterTable
70
- ALTER TABLE "categories" DROP CONSTRAINT "categories_pkey",
71
- ALTER COLUMN "id" SET DATA TYPE VARCHAR(36),
72
- ALTER COLUMN "name" SET DATA TYPE VARCHAR(16),
73
- ALTER COLUMN "user_id" SET DATA TYPE VARCHAR(128),
74
- ADD CONSTRAINT "categories_pkey" PRIMARY KEY ("id");
75
-
76
- -- AlterTable
77
- ALTER TABLE "images" DROP CONSTRAINT "images_pkey",
78
- ALTER COLUMN "id" SET DATA TYPE VARCHAR(36),
79
- ALTER COLUMN "user_id" SET DATA TYPE VARCHAR(128),
80
- ALTER COLUMN "content_type" SET DATA TYPE VARCHAR(32),
81
- ALTER COLUMN "description" SET DATA TYPE VARCHAR(1024),
82
- ALTER COLUMN "path" SET DATA TYPE VARCHAR(512),
83
- ADD CONSTRAINT "images_pkey" PRIMARY KEY ("id");
84
-
85
- -- AlterTable
86
- ALTER TABLE "notes" DROP CONSTRAINT "notes_pkey",
87
- ALTER COLUMN "id" SET DATA TYPE VARCHAR(36),
88
- ALTER COLUMN "title" SET DATA TYPE VARCHAR(64),
89
- ALTER COLUMN "user_id" SET DATA TYPE VARCHAR(128),
90
- ADD CONSTRAINT "notes_pkey" PRIMARY KEY ("id");
91
-
92
- -- AddForeignKey
93
- ALTER TABLE "articles" ADD CONSTRAINT "articles_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "categories"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,10 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `description` on the `images` table. All the data in the column will be lost.
5
- - You are about to drop the column `tags` on the `images` table. All the data in the column will be lost.
6
-
7
- */
8
- -- AlterTable
9
- ALTER TABLE "images" DROP COLUMN "description",
10
- DROP COLUMN "tags";
@@ -1,2 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "articles" ALTER COLUMN "og_image_url" SET DATA TYPE VARCHAR(4096);
@@ -1,8 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - Made the column `rating` on table `books` required. This step will fail if there are existing NULL values in that column.
5
-
6
- */
7
- -- AlterTable
8
- ALTER TABLE "books" ALTER COLUMN "rating" SET NOT NULL;
@@ -1,15 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - Column `title` length expanded from VARCHAR(256) to VARCHAR(512) to accommodate Google Books API titles.
5
- - Column `google_title` on table `books` will be dropped. Values are merged into `title` (Google Books value takes precedence when present).
6
-
7
- */
8
- -- AlterTable
9
- ALTER TABLE "books" ALTER COLUMN "title" TYPE VARCHAR(512);
10
-
11
- -- Backfill: prefer google_title when present
12
- UPDATE "books" SET "title" = "google_title" WHERE "google_title" IS NOT NULL AND "google_title" <> '';
13
-
14
- -- DropColumn
15
- ALTER TABLE "books" DROP COLUMN "google_title";