Skip to content

Commit 0731f89

Browse files
authored
Update install guides migration example (#68)
As it may be seen in [Oban](https://hexdocs.pm/oban/installation.html) it is recommended to set up hard version on the initial migration, so we can ensure the ErrorTracker database matches the same schema over time. This is important because other migrations may use our schema and if we do not specify it we may end up with the latest schema update (version 10 for example) when the next migration was expecting version 2.
1 parent e5eea0b commit 0731f89

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

guides/Getting Started.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ Open the generated migration and call the `up` and `down` functions on `ErrorTra
5353
defmodule MyApp.Repo.Migrations.AddErrorTracker do
5454
use Ecto.Migration
5555

56-
def up, do: ErrorTracker.Migration.up()
57-
def down, do: ErrorTracker.Migration.down()
56+
def up, do: ErrorTracker.Migration.up(version: 2)
57+
58+
# We specify `version: 1` in `down`, to ensure we remove all migrations.
59+
def down, do: ErrorTracker.Migration.down(version: 1)
5860
end
5961
```
6062

0 commit comments

Comments
 (0)