pagemachine/typo3-phinx

Phinx integration for TYPO3

Installs: 52 368

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 5

Forks: 2

Open Issues: 2

Type:typo3-cms-extension

1.1.11 2023-09-26 09:57 UTC

README

This package provides a integration of the Phinx database migration tool for TYPO3.

All Phinx commands have been wrapped as phinx:<command> and can be executed using the TYPO3 CLI or 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

Notice that these wrapper commands are executed by TYPO3, thus the full API like DataHandler can be used in migrations.

Migrations

The following paths are used for migrations:

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

Examples to create a migration in a TYPO3 project:

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

Note

If one Migrations directory exists already, you can omit --path. However, should multiple exist, you will receive a prompt and have to select the desired location.

Seeds

The following paths are used for seeds:

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

Examples to create a seed in a TYPO3 project:

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

Note

If one Migrations/Seed directory exists already, you can omit --path. However, should multiple exist, you will receive a prompt and have to select the desired location.

Testing

All tests can be executed with the shipped Docker Compose definition:

docker-compose run --rm app composer build