# Add ArchivedGitWorktree data model and DB operations \(\#53214\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f2ef43429ff4db6b2b735f3969e393b86bf7d8d4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f2ef43429ff4db6b2b735f3969e393b86bf7d8d4

Requested commit: f2ef43429ff4db6b2b735f3969e393b86bf7d8d4

Commit: f2ef43429ff4db6b2b735f3969e393b86bf7d8d4

Tree: 06ff36e6c4e1335ea15fc968cc1e480b73376950

Author: Richard Feldman

Committer: GitHub

## Message

```
Add ArchivedGitWorktree data model and DB operations (#53214)

Add the persistence layer for tracking archived git worktrees:

- `ArchivedGitWorktree` struct with `staged_commit_hash` and
`unstaged_commit_hash` fields to precisely identify WIP commits
- DB migrations for `archived_git_worktrees` and
`thread_archived_worktrees` (join table) tables
- CRUD operations: create, link to thread, query by thread, delete, mark
as restored
- `Column` impl for deserializing `ArchivedGitWorktree` from DB rows
- Tests for two-SHA round-trip, create/retrieve, delete, restore flag,
multi-thread linking, and multiple worktrees per thread

Part 2 of 3 in the persist-worktree stack. Stacked on #53213. This is
pure data model — nothing is wired up yet.

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
```

## Parents

- [29c965a616bf355015833de216415625aaa34acc](https://git.cafe/gitcafe/zed/commit/29c965a616bf355015833de216415625aaa34acc?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f2ef43429ff4db6b2b735f3969e393b86bf7d8d4?format=markdown)
