Skip to content

Commit 9f6a2c9

Browse files
khaliqgantclaude
andauthored
fix: remove unique constraint from workspace name in schema and tests (#113)
* fix: remove unique constraint from workspace name in schema and tests PR #76 added migration 0003 to drop the unique index on workspaces.name but didn't update the Drizzle schema or test SQL. This aligns both. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add migration to drop workspaces_name_unique index PR #76 updated the schema intent but never added the actual migration. The unique index from migration 0000 was still enforced in production. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a2a37ab commit 9f6a2c9

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

packages/server/src/__tests__/directory.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ PRAGMA foreign_keys = ON;
1616
1717
CREATE TABLE workspaces (
1818
id TEXT PRIMARY KEY NOT NULL,
19-
name TEXT NOT NULL UNIQUE,
19+
name TEXT NOT NULL,
2020
api_key_hash TEXT NOT NULL UNIQUE,
2121
system_prompt TEXT,
2222
plan TEXT NOT NULL DEFAULT 'free',

packages/server/src/__tests__/routing.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PRAGMA foreign_keys = ON;
1010
1111
CREATE TABLE workspaces (
1212
id TEXT PRIMARY KEY NOT NULL,
13-
name TEXT NOT NULL UNIQUE,
13+
name TEXT NOT NULL,
1414
api_key_hash TEXT NOT NULL UNIQUE,
1515
system_prompt TEXT,
1616
plan TEXT NOT NULL DEFAULT 'free',
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Drop global uniqueness constraint on workspace names.
2+
-- Workspace names are NOT globally unique — multiple workspaces can share a name.
3+
-- The apiKeyHash column remains globally unique for workspace identification.
4+
DROP INDEX IF EXISTS `workspaces_name_unique`;

packages/server/src/db/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { AnySQLiteColumn } from 'drizzle-orm/sqlite-core';
1414
// ============================================
1515
export const workspaces = sqliteTable('workspaces', {
1616
id: text('id').primaryKey(),
17-
name: text('name').notNull().unique(),
17+
name: text('name').notNull(),
1818
apiKeyHash: text('api_key_hash').notNull().unique(),
1919
systemPrompt: text('system_prompt'),
2020
plan: text('plan').notNull().default('free'),

0 commit comments

Comments
 (0)