first/last name instead ofj ust name, fix og migration instead of updating in second file sqlite issue
This commit is contained in:
@@ -28,17 +28,22 @@ class CreateContactUsFormSubmissions extends AbstractMigration {
|
||||
'limit' => 45,
|
||||
'null' => true,
|
||||
]);
|
||||
$table->addColumn('name', 'string', [
|
||||
$table->addColumn('first_name', 'string', [
|
||||
'default' => null,
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'null' => true,
|
||||
]);
|
||||
$table->addColumn('last_name', 'string', [
|
||||
'default' => null,
|
||||
'limit' => 255,
|
||||
'null' => true,
|
||||
]);
|
||||
$table->addColumn('email', 'string', [
|
||||
'default' => null,
|
||||
'limit' => 255,
|
||||
'null' => true,
|
||||
]);
|
||||
$table->addColumn('subject', 'string', [
|
||||
$table->addColumn('contact_subject', 'string', [
|
||||
'default' => null,
|
||||
'limit' => 255,
|
||||
'null' => true,
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user