pagemachine/typo3-phinx

TYPO3 的 Phinx 集成

安装数 58,608

依赖关系: 0

建议者: 0

安全性: 0

星标: 7

关注者: 5

分支: 2

开放性问题: 4

类型:typo3-cms-extension

1.1.11 2023-09-26 09:57 UTC

README

此包提供了TYPO3数据库迁移工具Phinx的集成。

所有Phinx命令都已包装为phinx:<command>,可以使用TYPO3 CLI或TYPO3 Console执行。

# Create a new migration
typo3cms phinx:create

# Migrate the database
typo3cms phinx:migrate

# Rollback the last or to a specific migration
typo3cms phinx:rollback

# Show migration status
typo3cms phinx:status

# Create a new database seeder
typo3cms phinx:seed:create

# Run database seeders
typo3cms phinx:seed:run

注意,这些包装命令由TYPO3执行,因此可以在迁移中使用完整的API,如DataHandler

迁移

以下路径用于迁移

  • vendor/*/*/Migrations/Phinx
  • vendor/*/*/Classes/Migrations/Phinx

以下路径用于TYPO3v11及更早版本

  • typo3conf/ext/*/Migrations/Phinx
  • typo3conf/ext/*/Classes/Migrations/Phinx

在TYPO3项目中创建迁移的示例

  • typo3cms phinx:create --path packages/provider/Classes/Migrations/Phinx MyMigration

注意

如果已经存在一个Migrations目录,则可以省略--path。但是,如果存在多个,您将收到提示并必须选择所需的位置。

种子

以下路径用于种子

  • vendor/*/*/Migrations/Phinx/Seeds
  • vendor/*/*/Classes/Migrations/Phinx/Seeds

以下路径用于TYPO3v11及更早版本

  • typo3conf/ext/*/Migrations/Phinx/Seeds
  • typo3conf/ext/*/Classes/Migrations/Phinx/Seeds

在TYPO3项目中创建种子的示例

  • typo3cms phinx:seed:create --path packages/provider/Classes/Migrations/Phinx/Seed MySeeder

注意

如果已经存在一个Migrations/Seed目录,则可以省略--path。但是,如果存在多个,您将收到提示并必须选择所需的位置。

测试

可以使用提供的Docker Compose定义执行所有测试。

docker compose run --rm app composer build