Skip to content

Commit 961b08e

Browse files
authored
Merge pull request #22 from dotkernel/issue-21
Issue #21: Added instructions to create migration
2 parents b949c00 + bb61a8a commit 961b08e

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

docs/book/v6/installation/doctrine-orm.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ We do not cover the creation steps of the database itself.
55

66
## Setup database
77

8-
Create a new MySQL database and set its collation to `utf8mb4_general_ci`.
8+
Create a new **MariaDB**/**MySQL** database and set its collation to `utf8mb4_general_ci`.
99

1010
Make sure you fill out the database credentials in `config/autoload/local.php` under `$databases['default']`.
11-
Below is the item you need to focus on.
12-
13-
> `my_database`, `my_user`, `my_password` are provided only as an example.
11+
Below is the item you need to focus on:
1412

1513
```php
1614
$databases = [
@@ -28,41 +26,53 @@ $databases = [
2826
];
2927
```
3028

31-
## Running migrations
29+
> `my_database`, `my_user`, `my_password` are provided only as an example.
30+
31+
### Creating migrations
32+
33+
Create a database migration by executing the following command:
34+
35+
```shell
36+
php ./vendor/bin/doctrine-migrations diff
37+
```
38+
39+
The new migration file will be placed in `src/Core/src/App/src/Migration/`.
3240

33-
Run the database migrations by using the following command:
41+
### Running migrations
42+
43+
Run the database migrations by executing the following command:
3444

3545
```shell
3646
php ./vendor/bin/doctrine-migrations migrate
3747
```
3848

39-
> If you have already run the migrations, you may get this message.
40-
> You should double-check to make sure the new migrations are ok to run.
49+
> If you have already run the migrations, you may get the below message:
4150
4251
```text
4352
WARNING! You have x previously executed migrations in the database that are not registered migrations.
4453
{migration list}
4554
Are you sure you wish to continue? (y/n)
4655
```
4756

48-
When using an empty database, you will get this confirmation message instead.
57+
> In this case, you should double-check to make sure the new migrations are ok to run.
58+
59+
When using an empty database, you will get this confirmation message:
4960

5061
```text
5162
WARNING! You are about to execute a migration in database "<your_database_name>" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no)
5263
```
5364

54-
Again, submit `y` to run all the migrations in chronological order.
65+
Hit `Enter` to confirm the operation.
66+
This will run all the migrations in chronological order.
5567
Each migration will be logged in the `migrations` table to prevent running the same migration more than once, which is often not desirable.
5668

5769
If everything ran correctly, you will get this confirmation.
5870

5971
```text
60-
[OK] Successfully migrated to version: Core\App\Migration\Version20250407142911
72+
[OK] Successfully migrated to version: Core\App\Migration\VersionYYYYMMDDHHMMSS
6173
```
6274

63-
> The migration name `Version20250407142911` may differ in future Admin updates.
64-
65-
## Fixtures
75+
### Fixtures
6676

6777
Run this command to populate the admin tables with the default values:
6878

0 commit comments

Comments
 (0)