@gigamusic/links 2.0.0 → 2.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gigamusic/links",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Editable Linktree-style link pages for gigamusic artist sites. Ships a Drizzle schema, admin API handler factories, and platform-detection helpers.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@gigamusic/core": "1.0.0",
35
- "@gigamusic/db": "2.0.0"
35
+ "@gigamusic/db": "2.0.1"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "drizzle-orm": ">=0.45",
@@ -5,11 +5,11 @@ export const INVALID_SLUG_MESSAGE =
5
5
  "Slug must be lowercase letters, numbers, and dashes";
6
6
  export const RESERVED_SLUG_MESSAGE = "Slug is reserved";
7
7
 
8
- /** True for Prisma's "unique constraint violated" code (P2002). */
8
+ /** True for the Postgres SQLSTATE 23505 (unique_violation). */
9
9
  export function isUniqueConstraintError(err: unknown): boolean {
10
10
  return (
11
11
  typeof err === "object" &&
12
12
  err !== null &&
13
- (err as { code?: string }).code === "P2002"
13
+ (err as { code?: string }).code === "23505"
14
14
  );
15
15
  }
@@ -1,9 +1,9 @@
1
- import { boolean, index, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
1
+ import { boolean, index, integer, pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
2
2
  import { releases } from "@gigamusic/db/schema";
3
3
 
4
4
  export const linkPageColumns = {
5
- id: integer().primaryKey().generatedAlwaysAsIdentity(),
6
- slug: text("slug").notNull().unique(),
5
+ id: serial("id").primaryKey(),
6
+ slug: text("slug").notNull().unique("link_pages_slug_key"),
7
7
  title: text("title").notNull(),
8
8
  description: text("description"),
9
9
  coverImageUrl: text("coverImageUrl"),
@@ -21,7 +21,7 @@ export const linkPages = pgTable("link_pages", linkPageColumns, (t) => [
21
21
  ]);
22
22
 
23
23
  export const linkPageItemColumns = {
24
- id: integer().primaryKey().generatedAlwaysAsIdentity(),
24
+ id: serial("id").primaryKey(),
25
25
  pageId: integer("pageId")
26
26
  .notNull()
27
27
  .references(() => linkPages.id, { onDelete: "cascade" }),