# Reorganize the structure of the collab crate's \`db\` module \(\#2866\) · gitcafe/zed

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

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

Visibility: public

Requested revision: ef9686c9887364f5ebb7367d7efcec4c964222d8

Requested commit: ef9686c9887364f5ebb7367d7efcec4c964222d8

Commit: ef9686c9887364f5ebb7367d7efcec4c964222d8

Tree: a0ce5048ce050cdb6c1cd595a22421b04aab37b1

Author: Max Brunsfeld

Committer: GitHub

## Message

````
Reorganize the structure of the collab crate's `db` module (#2866)

This PR just moves some code around, with the goal of making it easier
to find things in the `collab::db` module. That has become a large
module. Previously, most of the logic lived in one giant `impl Database`
item in `db.rs`.

I broke up this `impl` into several different `impl` blocks, grouped by
topic, each in a different file in a folder called `queries`.

I also pulled out the macro-generated id types into their own file,
moved the `TestDb` struct into its own file, and moved the `sea_orm`
entity declarations into a folder called `tables`.

New folder structure:

```
db
├── db_tests.rs
├── ids.rs
├── queries
│   ├── access_tokens.rs
│   ├── channels.rs
│   ├── contacts.rs
│   ├── projects.rs
│   ├── rooms.rs
│   ├── servers.rs
│   ├── signups.rs
│   └── users.rs
├── queries.rs
├── tables
│   ├── access_token.rs
│   ├── channel.rs
│   ├── channel_member.rs
│   ├── channel_path.rs
│   ├── contact.rs
│   ├── follower.rs
│   ├── language_server.rs
│   ├── project.rs
│   ├── project_collaborator.rs
│   ├── room.rs
│   ├── room_participant.rs
│   ├── server.rs
│   ├── signup.rs
│   ├── user.rs
│   ├── worktree.rs
│   ├── worktree_diagnostic_summary.rs
│   ├── worktree_entry.rs
│   ├── worktree_repository.rs
│   ├── worktree_repository_statuses.rs
│   └── worktree_settings_file.rs
├── tables.rs
└── test_db.rs
```

Release Notes:

- N/A
````

## Parents

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

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

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