-
Notifications
You must be signed in to change notification settings - Fork 16
[UI] Support repo snapshots #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
1e3c096
1b63040
4ff91b0
880c04c
1dd7c37
2ece924
edb7d0f
bb35923
d291948
b3c03e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| -- CreateTable | ||
| CREATE TABLE "YDocSnapshot" ( | ||
| "id" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "message" TEXT, | ||
| "yDocBlob" BYTEA, | ||
| "repoId" TEXT, | ||
|
|
||
| CONSTRAINT "YDocSnapshot_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "YDocSnapshot" ADD CONSTRAINT "YDocSnapshot_repoId_fkey" FOREIGN KEY ("repoId") REFERENCES "Repo"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "YDocSnapshot" ADD COLUMN "deleted" BOOLEAN NOT NULL DEFAULT false; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,16 @@ model UserRepoData { | |
| @@id([userId, repoId]) | ||
| } | ||
|
|
||
| model YDocSnapshot { | ||
| id String @id | ||
| createdAt DateTime @default(now()) | ||
| message String? | ||
| yDocBlob Bytes? | ||
| deleted Boolean @default(false) | ||
| repo Repo? @relation(fields: [repoId], references: [id]) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yDocBlob and repo/repoId sound to be required, not optional. I.e., |
||
| repoId String? | ||
| } | ||
|
Comment on lines
73
to
77
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to generate a new DB migration to reflect this change.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bb35923 addes the prisma migration. |
||
|
|
||
| model Repo { | ||
| id String @id | ||
| name String? | ||
|
|
@@ -83,6 +93,8 @@ model Repo { | |
| UserRepoData UserRepoData[] | ||
| stargazers User[] @relation("STAR") | ||
| yDocBlob Bytes? | ||
| yDocSnapshots YDocSnapshot[] | ||
|
|
||
| } | ||
|
|
||
| enum PodType { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to add
deletedhere since it adds complexity. We could reply on DB backup if we really want to ensure data safety.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not so familiar with DB backup, any reference for its pros and cons? I am considering a scenario where users might decide to delete a snapshot, but then want to undo the deletion later. Furthermore, if there are 1,000 users performing these operations at different times, can DB backups gracefully address this scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd skip this scenario for now. If the user deletes it, it is deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let me revert the change.