51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
use Migrations\AbstractMigration;
|
||
|
|
|
||
|
|
class AlterContactUsFormSubmissionsKeywords extends AbstractMigration {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* up Method.
|
||
|
|
*
|
||
|
|
* More information on this method is available here:
|
||
|
|
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function up(): void {
|
||
|
|
$table = $this->table('contact_us_form_submissions');
|
||
|
|
if ($table->hasColumn('subject')) {
|
||
|
|
$table->renameColumn('subject', 'contact_subject');
|
||
|
|
}
|
||
|
|
if ($table->hasColumn('name')) {
|
||
|
|
$table->renameColumn('name', 'first_name');
|
||
|
|
}
|
||
|
|
$table->addColumn('last_name', 'string', [
|
||
|
|
'limit' => 255,
|
||
|
|
'default' => null,
|
||
|
|
'null' => true,
|
||
|
|
]);
|
||
|
|
$table->update();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* down Method.
|
||
|
|
*
|
||
|
|
* More information on this method is available here:
|
||
|
|
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function down(): void {
|
||
|
|
$table = $this->table('contact_us_form_submissions');
|
||
|
|
if ($table->hasColumn('contact_subject')) {
|
||
|
|
$table->renameColumn('contact_subject', 'subject');
|
||
|
|
}
|
||
|
|
if ($table->hasColumn('fist_name')) {
|
||
|
|
$table->renameColumn('fist_name', 'name');
|
||
|
|
}
|
||
|
|
$table->removeColumn('last_name');
|
||
|
|
$table->update();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|