Skip to content

Commit 8a51fe7

Browse files
fix migrations
1 parent 46084c3 commit 8a51fe7

File tree

3 files changed

+24
-31
lines changed

3 files changed

+24
-31
lines changed

packages/db/prisma/migrations/20250919230022_add_is_public_column_to_repo_table/migration.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/db/prisma/migrations/20250919224623_add_permission_sync_tables/migration.sql renamed to packages/db/prisma/migrations/20250920232318_add_permission_sync_tables/migration.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ CREATE TYPE "RepoPermissionSyncJobStatus" AS ENUM ('PENDING', 'IN_PROGRESS', 'CO
55
CREATE TYPE "UserPermissionSyncJobStatus" AS ENUM ('PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED');
66

77
-- AlterTable
8-
ALTER TABLE "Repo" ADD COLUMN "permissionSyncedAt" TIMESTAMP(3);
8+
ALTER TABLE "Repo" ADD COLUMN "isPublic" BOOLEAN NOT NULL DEFAULT false,
9+
ADD COLUMN "permissionSyncedAt" TIMESTAMP(3);
910

1011
-- AlterTable
1112
ALTER TABLE "User" ADD COLUMN "permissionSyncedAt" TIMESTAMP(3);

packages/db/prisma/schema.prisma

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,29 @@ enum ChatVisibility {
4141
}
4242

4343
model Repo {
44-
id Int @id @default(autoincrement())
45-
name String // Full repo name, including the vcs hostname (ex. github.com/sourcebot-dev/sourcebot)
46-
displayName String? // Display name of the repo for UI (ex. sourcebot-dev/sourcebot)
47-
createdAt DateTime @default(now())
48-
updatedAt DateTime @updatedAt
49-
50-
/// When the repo was last indexed successfully.
51-
indexedAt DateTime?
44+
id Int @id @default(autoincrement())
45+
name String /// Full repo name, including the vcs hostname (ex. github.com/sourcebot-dev/sourcebot)
46+
displayName String? /// Display name of the repo for UI (ex. sourcebot-dev/sourcebot)
47+
createdAt DateTime @default(now())
48+
updatedAt DateTime @updatedAt
49+
indexedAt DateTime? /// When the repo was last indexed successfully.
5250
isFork Boolean
5351
isArchived Boolean
54-
isPublic Boolean?
55-
metadata Json // For schema see repoMetadataSchema in packages/backend/src/types.ts
52+
isPublic Boolean @default(false)
53+
metadata Json /// For schema see repoMetadataSchema in packages/backend/src/types.ts
5654
cloneUrl String
5755
webUrl String?
5856
connections RepoToConnection[]
5957
imageUrl String?
6058
repoIndexingStatus RepoIndexingStatus @default(NEW)
61-
permittedUsers UserToRepoPermission[]
6259
60+
permittedUsers UserToRepoPermission[]
6361
permissionSyncJobs RepoPermissionSyncJob[]
64-
/// When the permissions were last synced successfully.
65-
permissionSyncedAt DateTime?
62+
permissionSyncedAt DateTime? /// When the permissions were last synced successfully.
6663
67-
// The id of the repo in the external service
68-
external_id String
69-
// The type of the external service (e.g., github, gitlab, etc.)
70-
external_codeHostType String
71-
// The base url of the external service (e.g., https://github.com)
72-
external_codeHostUrl String
64+
external_id String /// The id of the repo in the external service
65+
external_codeHostType String /// The type of the external service (e.g., github, gitlab, etc.)
66+
external_codeHostUrl String /// The base url of the external service (e.g., https://github.com)
7367
7468
org Org @relation(fields: [orgId], references: [id], onDelete: Cascade)
7569
orgId Int
@@ -88,10 +82,10 @@ enum RepoPermissionSyncJobStatus {
8882
}
8983

9084
model RepoPermissionSyncJob {
91-
id String @id @default(cuid())
92-
status RepoPermissionSyncJobStatus @default(PENDING)
93-
createdAt DateTime @default(now())
94-
updatedAt DateTime @updatedAt
85+
id String @id @default(cuid())
86+
status RepoPermissionSyncJobStatus @default(PENDING)
87+
createdAt DateTime @default(now())
88+
updatedAt DateTime @updatedAt
9589
completedAt DateTime?
9690
9791
errorMessage String?
@@ -327,15 +321,15 @@ enum UserPermissionSyncJobStatus {
327321
}
328322

329323
model UserPermissionSyncJob {
330-
id String @id @default(cuid())
331-
status UserPermissionSyncJobStatus @default(PENDING)
332-
createdAt DateTime @default(now())
333-
updatedAt DateTime @updatedAt
324+
id String @id @default(cuid())
325+
status UserPermissionSyncJobStatus @default(PENDING)
326+
createdAt DateTime @default(now())
327+
updatedAt DateTime @updatedAt
334328
completedAt DateTime?
335329
336330
errorMessage String?
337331
338-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
332+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
339333
userId String
340334
}
341335

0 commit comments

Comments
 (0)