@directus-labs/migration-bundle

中文文档
1.2.0发布于 2026/03/04MITES Module近 30 天下载 2336

Migrate from the current source Directus instance to another target Directus instance.

原始使用文档
文档目录13 节
  1. Usage
  2. Incomatible Schema
  3. Failed Migration
  4. Requirements
  5. Installation
  6. Configuration
  7. Hybrid Configuration System
  8. 1. Environment Variables (Admin Defaults)
  9. 2. Directus Presets (User Configurations)
  10. 3. Configuration Priority
  11. How to Customize the Migration
  12. File Batch Size
  13. Permissions

Directus Migration Module

Migrate the current Directus instance to another location with ease, using this simple module.

Migration Module Banner

Usage

Once installed you can enable the navigation menu item in your Project Settings or go straight to the module page at /admin/migration.

To get started, enter the destination URL and admin token into the fields provided, then click Check. This will compare both Directus platform and see if they are compatible.

Please make sure the destination instance is on the same version and the same database platform as the source instance.

If valid, you can start the "Dry Run" migration straight away or customize the migration as required.

Run the migration by unchecking the Dry Run checkbox and click start. The process runs in the background so you can close your browser and it will notify you when the migration is complete. Normally, a small to medium project will only be a 1 - 2 minutes. Projects will large file libraries will take much longer.

Migration Live Updates

Incomatible Schema

The destination instance must be the same version and the same database platform as the source instance. This can be overriden using the Force checkbox which appears when this error occurs.

This is not recommended and will most likely need further intervention.

Failed Migration

If the migration fails, don't worry, simply run the migration again. Existing content is skipped so it will continue where it left off.

Requirements

  • 2x Directus instances on at least 11.1.2+ using the same database platform.
  • Admin user and admin token from destination.

For larger projects, migrations naturally use significant bandwidth. Limits have been placed on API calls to ensure the destination is not overwhelmed.

Installation

Refer to the Official Guide for details on installing the extension from the Marketplace or manually.

Configuration

Hybrid Configuration System

The migration module uses a two-tier configuration system combining environment variables and Directus presets for maximum flexibility.

1. Environment Variables (Admin Defaults)

Administrators can set default values that apply to all users via environment variables:

# Default destination URL
MIGRATION_BUNDLE_DEFAULT_URL=https://stage.example.com

# Default admin token (optional - can be left empty for security)
MIGRATION_BUNDLE_DEFAULT_TOKEN=your-admin-token

# Default selected options (comma-separated)
MIGRATION_BUNDLE_DEFAULT_OPTIONS=content,users,flows

Available options for MIGRATION_BUNDLE_DEFAULT_OPTIONS:

  • content - Collections and their data
  • users - Users, roles, and permissions
  • comments - Activity comments
  • presets - User bookmarks
  • dashboards - Insights dashboards
  • extensions - Installed extensions
  • flows - Automation flows

2. Directus Presets (User Configurations)

Users can save their migration configurations as Directus presets, which are stored in the database and accessible across sessions and devices.

Features:

  • Named Configurations: Save multiple configs like "Production Sync", "Content Only", "Full Migration"
  • Scope Control: Save presets for yourself, your role, or globally (admin only)
  • Quick Access: Load saved configurations from a dropdown menu
  • Override Defaults: User presets take precedence over environment defaults

How to use:

  1. Configure your migration settings (URL, token, options)
  2. Click the bookmark icon (📑) to save as a preset
  3. Choose a name and scope (personal/role/global)
  4. Load saved presets from the dropdown above the form

3. Configuration Priority

The system follows this priority order:

  1. User-selected preset (highest priority)
  2. Environment defaults (if no preset selected)
  3. Empty form (if neither configured)

This approach provides:

  • For Admins: Environment-specific defaults across environments
  • For Users: Personal saved configurations
  • For Teams: Shared configurations via role-based presets
  • Best Practice: Consistent setups with flexibility

How to Customize the Migration

  1. On the migration module, add the destination server and token and click Check
  2. If valid, the Migration options field will appear. Click this to reveal what is migrated
  3. Uncheck any sections to exclude from the migration
  4. Start the migration

File Batch Size

When the content scope is selected, a Batch size control appears. This controls how many files are read into memory and uploaded before a new batch begins.

ValueBehavior
5Lowest memory usage — best for constrained environments
10 (default)Suitable for most projects
15Moderate speed increase
20Faster on high-bandwidth connections
25Maximum throughput — higher memory usage

When to adjust:

  • Lower the batch size if the migration runs out of memory or the source/destination server is under heavy load.
  • Raise the batch size if you have a fast connection and want to speed up large file libraries.

Customise the module

Permissions

This extension requires admin privilages on both instances to ensure all data is accessible and writable.

版本与发布记录

@directus-labs/migration-bundle 共发布 5 个版本,首次发布于 2025/03/06;过去 12 个月发布了 1 个版本。

版本发布日期距今
1.2.0latest2026/03/048 个月前
1.1.12025/10/131.1 年前
1.1.02025/10/101.1 年前
1.0.12025/04/251.6 年前
1.0.02025/03/061.7 年前

关于 @directus-labs/migration-bundle 的常见问题

@directus-labs/migration-bundle 是什么?

Migrate from the current source Directus instance to another target Directus instance.

如何安装 @directus-labs/migration-bundle?

在项目目录运行 npm install @directus-labs/migration-bundle,或使用 pnpm add / yarn add / bun add。

@directus-labs/migration-bundle 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/directus-labs__migration-bundle 是否存在。

@directus-labs/migration-bundle 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@directus-labs/migration-bundle 可以商用吗?

@directus-labs/migration-bundle 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@directus-labs/migration-bundle 的下载量有多少?

根据 npm 官方下载统计,@directus-labs/migration-bundle 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,336 次,日均约 78 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@directus-labs/migration-bundle 还在维护吗?

最新版本 1.2.0 发布于 2026/03/04(8 个月前);至今共发布 5 个版本,其中过去 12 个月发布了 1 个;首次发布于 2025/03/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。