bedezign / yii2-migration-proxy
Migration proxy component for Yii2
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 2
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: dev-master
This package is not auto-updated.
Last update: 2024-12-21 17:27:42 UTC
README
Ever had the issue that you have to run some database migrations from a component you use but you find that you have to manually specify the path to do so. If you have multiple environments you also have to remember to run that migration command on all your environments. Working as a part of a bigger team this becomes even more annoying.
I would love to just include those migrations as part of the main migration flow in the application, so I wrote this proxy.
Using it is really simple:
<?php
class mDDMMYY_HHMMSS_table extends \yii\db\Migration
{
public function up()
{
$this->proxy->migrateUp('mDDMMYY_HHMMSS_vendor_migration');
}
public function down()
{
$this->proxy->migrateUp('mDDMMYY_HHMMSS_vendor_migration');
}
protected function getProxy()
{
return new \bedezign\yii2\migrationproxy\MigrationProxy(['migrationPath' => '@vendor/vendor-migration-folder/migrations']);
}
}
Note that the vendor migrations will be created as separate migration rules in your migration table (so on top of the one your migration file creates), but other than than you don't have to do anything special.