Skip to content

Commit 57eefb6

Browse files
committed
Vagrant? 😅
1 parent 94f3b54 commit 57eefb6

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

docs/5.x/extend/migrations.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,37 @@
22

33
Migrations are PHP classes that make one-time changes to the system.
44

5-
For the most part, migrations in Craft work similarly to [Yii’s implementation](https://www.yiiframework.com/doc/guide/2.0/en/db-migrations), but unlike Yii, Craft manages three different types of migrations:
5+
For the most part, migrations in Craft work similarly to [Yii’s implementation](guide:db-migrations). _Unlike_ Yii, Craft manages three different types of migrations:
66

7-
- **App migrations** – Craft’s own internal migrations.
8-
- **Plugin migrations** – Each installed plugin has its own migration track.
9-
- **Content migrations** – Your Craft project itself can have migrations, too.
7+
App migrations
8+
: Craft’s own internal migrations. You will only create an `app` migration when contributing to Craft. Every Craft installation runs these migrations after an update.
109

11-
## Creating Migrations
12-
13-
::: tip
14-
If your Craft install is running from a Vagrant box, you will need to SSH into the box to run these commands.
15-
:::
10+
Plugin migrations
11+
: Each installed plugin has its own migration “track.” Only Craft projects that have your plugin installed and enabled will run these migrations.
1612

17-
To create a new migration for your plugin or project, open up your terminal and go to your Craft project:
13+
Content migrations
14+
: Migrations specific to your Craft project. These often contain steps that manipulate data based on handles or other identifiers that are only relevant internally.
1815

19-
```bash
20-
cd /path/to/project
21-
```
16+
## Creating Migrations
2217

23-
Then run the following command to generate a new migration file for your plugin or project:
18+
To create a new migration, use the `migrate/create` command:
2419

2520
::: code
26-
2721
```bash Plugin Migration
2822
php craft migrate/create my_migration_name --plugin=my-plugin-handle
2923
```
30-
3124
```bash Content Migration
3225
php craft migrate/create my_migration_name
3326
```
34-
3527
:::
3628

37-
Enter `yes` at the prompt, and a new migration file will be created for you. You can find it at the file path output by the command.
29+
Enter `yes` at the prompt, and a new migration file will be created for you. You can find it at the file path output by the command; migration classes include a timestamp prefix with the format `mYYMMDD_HHMMSS`, like `m250923_000000`.
3830

39-
If this is a plugin migration, increase your plugin’s [schema version](craft5:craft\base\PluginTrait::$schemaVersion), so Craft knows to check for new plugin migrations as people update to your new version.
31+
This file and class should _never_ be renamed after release! Doing so can cause it to run again, or out of order.
32+
33+
::: tip
34+
If this is a plugin migration, increase your plugin’s [schema version](craft5:craft\base\PluginTrait::$schemaVersion), so Craft knows to check for new plugin migrations after an update.
35+
:::
4036

4137
### What Goes Inside
4238

0 commit comments

Comments
 (0)