diff --git a/app/lib/db/schema.ts b/app/lib/db/schema.ts index f6d2c11..3f6eee8 100644 --- a/app/lib/db/schema.ts +++ b/app/lib/db/schema.ts @@ -35,11 +35,13 @@ export const roomViewers = pgTable("room_viewers", { export const presets = pgTable("presets", { id: uuid("id").primaryKey().defaultRandom(), createdBy: text("created_by").notNull(), - name: text("name").notNull().unique(), + name: text("name").notNull(), iceServers: text("ice_servers").notNull(), // stringified json obv shareable: boolean("shareable").notNull().default(false), createdAt: timestamp("created_at").notNull().defaultNow(), -}); +}, (table) => ({ + uniqueUserPresetName: uniqueIndex().on(table.createdBy, table.name), +})); export const presetUsers = pgTable( "preset_users", diff --git a/app/pages/index.vue b/app/pages/index.vue index 49d7177..c983c5d 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -1,13 +1,20 @@