Skip to content

Commit 3d87ac7

Browse files
committed
Bump version to 1.0.1, source the CLI version from dune-build-info, and update the changelog
1 parent 7be03d7 commit 3d87ac7

5 files changed

Lines changed: 28 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this project are documented here. The format is based on
44
[Keep a Changelog](https://keepachangelog.com/), and this project adheres to
55
[Semantic Versioning](https://semver.org/).
66

7+
## 1.0.1
8+
9+
### Fixed
10+
- `rollback` and `redo` now validate applied migrations against the files on
11+
disk before running and return `Error` on drift (a modified or missing
12+
applied migration), just like `migrate`. Previously they could roll back
13+
using modified down SQL or silently skip a migration whose file was gone.
14+
- `status` now includes an applied migration whose file is missing (shown as
15+
`(migration file missing)`) instead of hiding it and understating the applied
16+
count.
17+
- Database lifecycle commands (`create_database`/`drop_database`) now quote and
18+
escape the database identifier in the generated DDL, so PostgreSQL names such
19+
as `my-db` work and MariaDB names containing backticks are handled safely.
20+
721
## 1.0.0
822

923
First stable release.

bin/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
(modules main commands)
55
(libraries
66
migra
7+
dune-build-info
78
lwt
89
lwt.unix
910
caqti

bin/main.ml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,19 @@ let status_cmd =
193193
let info = Cmd.info "status" ~doc:"Show migration status" in
194194
Cmd.v info Term.(const run $ migrations_dir_arg $ table_arg $ db_url_arg)
195195

196+
(* The version stamped into the build by dune from the package version in
197+
dune-project (and VCS info), so it never has to be hand-edited here. It is
198+
[None] only in unusual builds with no version info; fall back to "dev" then. *)
199+
let version =
200+
match Build_info.V1.version () with
201+
| Some v -> Build_info.V1.Version.to_string v
202+
| None -> "dev"
203+
196204
(* Main command group *)
197205
let main_cmd =
198206
let doc = "Simple database migration tool for OCaml" in
199207
let sdocs = Manpage.s_common_options in
200-
let info = Cmd.info "migra" ~version:"1.0.0" ~doc ~sdocs in
208+
let info = Cmd.info "migra" ~version ~doc ~sdocs in
201209
Cmd.group info
202210
[
203211
generate_cmd;

dune-project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
(name migra)
44

5-
(version 1.0.0)
5+
(version 1.0.1)
66

77
(generate_opam_files true)
88

@@ -23,6 +23,7 @@
2323
"A database migration tool and library for OCaml. Migrations are plain SQL with up and down sections, and the database (PostgreSQL, MariaDB/MySQL, or SQLite) is selected from the connection URL. Applied migrations are tracked with checksums, and drift (a modified, missing, or out-of-order migration) is detected before anything runs. It can be used from the command line or embedded as a library to migrate on application startup.")
2424
(depends
2525
(ocaml (>= 4.14.0))
26+
(dune-build-info (>= 3.12))
2627
(lwt (>= 5.6.0))
2728
(alcotest (and :with-test (>= 1.7.0)))
2829
(alcotest-lwt (and :with-test (>= 1.7.0)))

migra.opam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is generated by dune, edit dune-project instead
22
opam-version: "2.0"
3-
version: "1.0.0"
3+
version: "1.0.1"
44
synopsis:
55
"A database migration tool and library for OCaml supporting PostgreSQL, MariaDB/MySQL, and SQLite"
66
description:
@@ -15,6 +15,7 @@ bug-reports: "https://github.com/dsincl12/migra/issues"
1515
depends: [
1616
"dune" {>= "3.12"}
1717
"ocaml" {>= "4.14.0"}
18+
"dune-build-info" {>= "3.12"}
1819
"lwt" {>= "5.6.0"}
1920
"alcotest" {with-test & >= "1.7.0"}
2021
"alcotest-lwt" {with-test & >= "1.7.0"}

0 commit comments

Comments
 (0)