Repository navigation
Command create
github-actions[bot] edited this page Nov 17, 2026
·
1 revision
Creates a new migration file. Tool only. It only reads project and migrationTemplate from the config, so it works
without connection variables set.
migrate-mongo create <name> [--minimal]
$ migrate-mongo create AddEmailIndexToUsers
Created src/MyApp.Migrations/Migrations/M20261014164028_AddEmailIndexToUsers.cs
| Meaning | |
|---|---|
<name> |
The migration's name in PascalCase, e.g. AddEmailIndexToUsers. It becomes the class name, and in kebab-case (add-email-index-to-users) the migration's name. |
--minimal |
Write bare UpAsync and DownAsync methods, without the commented results and tracking examples. Ignores migrationTemplate. |
The file goes in the project's Migrations folder, as M<id>_<Name>.cs, in the <project root namespace>.Migrations
namespace. The id is the current UTC time (yyyyMMddHHmmss); if a migration already has that id, it steps forward a
second.
With migrationTemplate set, that file is used instead of the built-in template.
See Custom Templates.
Kevsoft.MigrateMongo ·
NuGet ·
Releases ·
Issues ·
Found a mistake? These pages live in
wiki/ on main; pull requests welcome.
Get started
Migrations
- Writing Migrations
- Transactions
- Recording Results
- Dependency Injection
- Custom Templates
- Adopting an Existing Database
Collections
- Managing Collections
- Indexes
- Search Indexes
- Collection Options
- Validators
- Views
- Undeclared Collections
Deploying
Connecting
Reference
Concepts