Files
cake-addresses/config/Migrations/20251121020203_InitialAddressesDynamicForeignKey.php
Brandon Shipley d06f9481f6
Some checks failed
CI / testsuite (pgsql, 8.2, ) (push) Successful in 5m36s
CI / testsuite (mysql, 8.2, ) (push) Successful in 5m53s
CI / testsuite (mysql, 8.4, ) (push) Successful in 8m59s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 5m34s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Failing after 4m14s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 9m1s
CI / Coding Standard & Static Analysis (push) Successful in 4m23s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 8m36s
migrations fix basemigration not abstract migration
2026-03-20 23:28:31 -07:00

45 lines
941 B
PHP

<?php
declare(strict_types=1);
use Migrations\BaseMigration;
class InitialAddressesDynamicForeignKey extends BaseMigration {
/**
* Up Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-up-method
* @return void
*/
public function up(): void {
$this->table('addresses')
->addColumn('foreign_key', 'string', [
'limit' => 45,
'null' => true,
'default' => null,
])
->addColumn('model', 'string', [
'limit' => 255,
'null' => true,
'default' => null,
])
->update();
}
/**
* Down Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-down-method
* @return void
*/
public function down(): void {
$this->table('addresses')
->removeColumn('foreign_key')
->removeColumn('model')
->save();
}
}