Skip to content

Commit eb5d4b2

Browse files
authored
Merge pull request #5631 from kenjis/fix-docs-dbmgmt/migration.rst
docs: fix dbmgmt/migration.rst
2 parents d8ffc5c + b5c02e9 commit eb5d4b2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

user_guide_src/source/dbmgmt/migration.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ but you would then be responsible for telling other developers that they
88
need to go and run them. You would also have to keep track of which changes
99
need to be run against the production machines next time you deploy.
1010

11-
The database table **migration** tracks which migrations have already been
11+
The database table **migrations** tracks which migrations have already been
1212
run so all you have to do is make sure your migrations are in place and
1313
call ``$migration->latest()`` to bring the database up to the most recent
1414
state. You can also use ``$migration->setNamespace(null)->latest()`` to
@@ -24,24 +24,24 @@ Migration file names
2424

2525
Each Migration is run in numeric order forward or backwards depending on the
2626
method taken. Each migration is numbered using the timestamp when the migration
27-
was created, in **YYYYMMDDHHIISS** format (e.g., **20121031100537**). This
27+
was created, in **YYYY-MM-DD-HHIISS** format (e.g., **2012-10-31-100537**). This
2828
helps prevent numbering conflicts when working in a team environment.
2929

3030
Prefix your migration files with the migration number followed by an underscore
3131
and a descriptive name for the migration. The year, month, and date can be separated
3232
from each other by dashes, underscores, or not at all. For example:
3333

34-
* 20121031100537_add_blog.php
35-
* 2012-10-31-100538_alter_blog_track_views.php
36-
* 2012_10_31_100539_alter_blog_add_translations.php
34+
* 2012-10-31-100538_AlterBlogTrackViews.php
35+
* 2012_10_31_100539_AlterBlogAddTranslations.php
36+
* 20121031100537_AddBlog.php
3737

3838
******************
3939
Create a Migration
4040
******************
4141

4242
This will be the first migration for a new site which has a blog. All
4343
migrations go in the **app/Database/Migrations/** directory and have names such
44-
as *20121031100537_add_blog.php*.
44+
as **2022-01-31-013057_AddBlog.php**.
4545
::
4646

4747
<?php
@@ -83,8 +83,10 @@ as *20121031100537_add_blog.php*.
8383
The database connection and the database Forge class are both available to you through
8484
``$this->db`` and ``$this->forge``, respectively.
8585

86-
Alternatively, you can use a command-line call to generate a skeleton migration file. See
87-
below for more details.
86+
Alternatively, you can use a command-line call to generate a skeleton migration file.
87+
See **make:migration** in :ref:`command-line-tools` for more details.
88+
89+
.. note:: Since the migration class is a PHP class, the classname must be unique in every migration file.
8890

8991
Foreign Keys
9092
============
@@ -183,6 +185,8 @@ to update the schema::
183185
}
184186
}
185187

188+
.. _command-line-tools:
189+
186190
*******************
187191
Command-Line Tools
188192
*******************

0 commit comments

Comments
 (0)