Init: possible confusion if base+modified schemas already exist but local project dir doesn't

Open
#175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
50/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
postgresql, python
Domain
databases

Research direction

Inspect the initialization flow where db-sync downloads the Mergin Maps project, and trace how the existing base and modified schemas are read from the database. Check the project ID before downloading; done means an incompatible ID produces an error instead of attempting the download.

Written by the indexing model from the issue text.

Description

bug

Seen the following case:

  • configuration file "base" and "modified" schemas already exist in the database
  • the project directory does not exist yet

In this scenario, db-sync will download the MM project at a particular version, but it does not check project ID first. This is a potential problem, because db-sync may try to download a project that is incompatible with the data already stored in the database - this can result in trying to fetch project at e.g. version 1234, but project may not even exist in such version, so the project download will fail.

The fix should be to check project ID before project's download, and fail with error if they do not match.

Dominant language
Python
Stars
53
Forks
24
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MerginMaps/db-sync

All issues in MerginMaps/db-sync

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.