The initial version of your migrations/init.lua
file will point to a single migration.
While there is no strict rule for naming your migration files, there is a convention that the
initial one is prefixed by 000
, the next one by 001
, and so on.
If the first migration is named 000_base_my_plugin.lua
, the init.lua
file should like this:
return {
"000_base_my_plugin",
}
Sometimes it is necessary to introduce changes after a version of a plugin has already been
released. A new functionality might be needed. A database table row might need changing.
When this happens, you must create a new migrations file.
You must not modify the existing migration files once they are published.
Following with our previous example, if we wanted to release a new version of the plugin with changes in the database, we would insert it by adding a file called <plugin_name>/migrations/001_100_to_110.lua
, and referencing it in init.lua
like this:
return {
"000_base_my_plugin",
"001_100_to_110",
}
In this example, 100
is the previous version of the plugin 1.0.0
and 110
is the version to which plugin is migrated, 1.1.0
.