-
Notifications
You must be signed in to change notification settings - Fork 18
[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
Open
senwang86
wants to merge
10
commits into
codepod-io:main
Choose a base branch
from
senwang86:UI_repo_snapshots
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1e3c096
Add repo snapshots
1b63040
refine gql and clean up
4ff91b0
Address comments
880c04c
Add deleted filed in YDocSnapshot
1dd7c37
clean up
2ece924
Revert "Add deleted filed in YDocSnapshot"
edb7d0f
Address comments
bb35923
Update_prisma_schema
d291948
clean prisma migration sql
b3c03e0
Merge branch 'main' into UI_repo_snapshots
lihebi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
api/prisma/migrations/20230818010514_add_y_doc_snapshot_model/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
2 changes: 2 additions & 0 deletions
2
api/prisma/migrations/20230818171831_add_deleted_filed_in_y_doc_snapshot/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]) | ||
|
||
| repoId String? | ||
| } | ||
|
|
||
| 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 { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.