• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cljoly / rusqlite_migration / 14429937128
95%

Build:
DEFAULT BRANCH: master
Ran 13 Apr 2025 01:30PM UTC
Jobs 1
Files 5
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Apr 2025 01:29PM UTC coverage: 94.083% (+0.04%) from 94.048%
14429937128

push

github

cljoly
feat: expose the number of migrations to be applied

This is a slightly different take on #170, where instead of returning
the total number of migrations defined, we return the number of
migrations defined, but not yet applied.

Going back to the discussion in #170, what we actually need is:
1. tell whether migrations will be run, without actually running them.
   One use of this information is to run a backups before applying the
   migrations.
2. [“see the version difference somehow”][diff], i.e. the number of
   migrations to be applied.

Thus I think that returning the number of migrations to be applied,
instead of the number of migrations already applied fulfills the need
better. And it is less of a foot gun in my opinion:
1. The index in the vector of migration is off by one compared to the
   index in the user version, which is the one exposed by
   [`to_version()`][to_version] effectively. In other words, the first
   migration in the array is index 0, but that’s effectively version 1.
2. As discussed in #170, users might be tempted to write something like:
   ```rust
   if migrations.needs_to_run() {
     migrations.to_latest()
   }
   ```
   which would be suboptimal, as `to_latest` performs the same check.

Closes https://github.com/cljoly/rusqlite_migration/issues/170

[to_version]: https://docs.rs/rusqlite_migration/1.3.1/rusqlite_migration/struct.AsyncMigrations.html#example-4
[difference]: https://github.com/cljoly/rusqlite_migration/issues/170#issuecomment-2343979134

Builds-on: https://github.com/cljoly/rusqlite_migration/pull/171
Co-authored-by: Alex Helfet <alex.helfet@gmail.com>

2 of 2 new or added lines in 1 file covered. (100.0%)

318 of 338 relevant lines covered (94.08%)

5.69 hits per line

Jobs
ID Job ID Ran Files Coverage
1 14429937128.1 13 Apr 2025 01:30PM UTC 5
94.08
GitHub Action Run
Source Files on build 14429937128
  • Tree
  • List 5
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 22e634a7 on github
  • Prev Build on master (#14409648104)
  • Next Build on master (#14430134663)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc