diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-12-22 00:12:46 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-12-22 12:03:24 +0100 |
commit | b1d8fede465950e5d1a0d6521a6d862a02e9ce36 (patch) | |
tree | 8233350acc1b4327516729b37e39baa414653810 /db | |
parent | 330356043df8e9c08fb3a408c74fe54bc2b9813d (diff) |
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)
Diffstat (limited to 'db')
-rw-r--r-- | db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php new file mode 100644 index 00000000..0478b138 --- /dev/null +++ b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php @@ -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(); + }); + } + } +} |