From b1d8fede465950e5d1a0d6521a6d862a02e9ce36 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sat, 22 Dec 2018 00:12:46 +0100 Subject: 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) --- ...000000_change_users_contact_dect_field_size.php | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php (limited to 'db') 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 @@ + '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(); + }); + } + } +} -- cgit v1.2.3-54-g00ecf