# Perform any long-running migrations in temp storage
49
$ bin/migrations prepare-upgrade
50
# Swap temp storage into place and run short-running migrations
48
51
$ bin/migrations upgrade
49
52
Updated the datastore to version: 1
50
53
55
58
56
59
::
57
60
58
$ bin/migrations upgrade --init
61
$ bin/migrations prepare-upgrade --init
59
62
Updated the datastore to version: 1
63
64
65
Deleting migrations
66
~~~~~~~~~~~~~~~~~~~
67
The most recent migration must not be deleted, because it also serves to identify the current migration version for up-to-date instances. All other migrations can safely be deleted if they are no longer needed. So if all production instances have had the migration applied, it is safe to simply delete it.
68
69
Avoid performing an es-update in migrations
70
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71
The charm and Makefile ensure that es-update is run before running the code, so it is unnecessary to run es-update in a migration.