user: allow up to 40 characters for dect numbers
closes #309 (EPVPN number in DECT field is shortened) closes #529 (For dect numbers are only 5 digits allowed)main
parent
330356043d
commit
b1d8fede46
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Engelsystem\Migrations;
|
||||||
|
|
||||||
|
use Engelsystem\Database\Migration\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
class ChangeUsersContactDectFieldSize extends Migration
|
||||||
|
{
|
||||||
|
/** @var array */
|
||||||
|
protected $tables = [
|
||||||
|
'AngelTypes' => 'contact_dect',
|
||||||
|
'users_contact' => 'dect',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migration
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->changeDectTo(40);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->changeDectTo(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $length
|
||||||
|
*/
|
||||||
|
protected function changeDectTo(int $length)
|
||||||
|
{
|
||||||
|
foreach ($this->tables as $table => $column) {
|
||||||
|
if (!$this->schema->hasTable($table)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->schema->table($table, function (Blueprint $table) use ($column, $length) {
|
||||||
|
$table->string($column, $length)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Loading…
Reference in New Issue