@@ -8,7 +8,7 @@ but you would then be responsible for telling other developers that they
88need to go and run them. You would also have to keep track of which changes
99need 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
1212run so all you have to do is make sure your migrations are in place and
1313call ``$migration->latest() `` to bring the database up to the most recent
1414state. You can also use ``$migration->setNamespace(null)->latest() `` to
@@ -24,24 +24,24 @@ Migration file names
2424
2525Each Migration is run in numeric order forward or backwards depending on the
2626method 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
2828helps prevent numbering conflicts when working in a team environment.
2929
3030Prefix your migration files with the migration number followed by an underscore
3131and a descriptive name for the migration. The year, month, and date can be separated
3232from 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******************
3939Create a Migration
4040******************
4141
4242This will be the first migration for a new site which has a blog. All
4343migrations 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*.
8383The 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
8991Foreign Keys
9092============
@@ -183,6 +185,8 @@ to update the schema::
183185 }
184186 }
185187
188+ .. _command-line-tools :
189+
186190*******************
187191Command-Line Tools
188192*******************
0 commit comments