|
| 1 | +<?php |
| 2 | + |
| 3 | +use Illuminate\Database\Migrations\Migration; |
| 4 | +use Illuminate\Database\Schema\Blueprint; |
| 5 | +use Illuminate\Support\Facades\Schema; |
| 6 | + |
| 7 | +class AlterFieldsForEncryptionOnLaravelCrmTables extends Migration |
| 8 | +{ |
| 9 | + /** |
| 10 | + * Run the migrations. |
| 11 | + * |
| 12 | + * @return void |
| 13 | + */ |
| 14 | + public function up() |
| 15 | + { |
| 16 | + if (config('laravel-crm.encrypt_db_fields')) { |
| 17 | + Schema::table(config('laravel-crm.db_table_prefix').'people', function (Blueprint $table) { |
| 18 | + $table->string('title', 500)->nullable()->change(); |
| 19 | + $table->string('first_name', 500)->change(); |
| 20 | + $table->string('middle_name', 500)->nullable()->change(); |
| 21 | + $table->string('last_name', 500)->nullable()->change(); |
| 22 | + $table->string('maiden_name', 500)->nullable()->change(); |
| 23 | + }); |
| 24 | + |
| 25 | + Schema::table(config('laravel-crm.db_table_prefix').'organisations', function (Blueprint $table) { |
| 26 | + $table->string('name', 1000)->nullable()->change(); |
| 27 | + }); |
| 28 | + |
| 29 | + Schema::table(config('laravel-crm.db_table_prefix').'addresses', function (Blueprint $table) { |
| 30 | + $table->string('address', 1000)->nullable()->change(); |
| 31 | + $table->string('line1', 1000)->change(); |
| 32 | + $table->string('line2', 1000)->nullable()->change(); |
| 33 | + $table->string('line3', 1000)->nullable()->change(); |
| 34 | + $table->string('code', 500)->nullable()->change(); |
| 35 | + $table->string('city', 500)->nullable()->change(); |
| 36 | + $table->string('state', 500)->nullable()->change(); |
| 37 | + $table->string('country', 500)->nullable()->change(); |
| 38 | + }); |
| 39 | + |
| 40 | + Schema::table(config('laravel-crm.db_table_prefix').'emails', function (Blueprint $table) { |
| 41 | + $table->string('address', 500)->nullable()->change(); |
| 42 | + }); |
| 43 | + |
| 44 | + Schema::table(config('laravel-crm.db_table_prefix').'phones', function (Blueprint $table) { |
| 45 | + $table->string('number', 500)->nullable()->change(); |
| 46 | + }); |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Reverse the migrations. |
| 52 | + * |
| 53 | + * @return void |
| 54 | + */ |
| 55 | + public function down() |
| 56 | + { |
| 57 | + if (config('laravel-crm.encrypt_db_fields')) { |
| 58 | + Schema::table(config('laravel-crm.db_table_prefix').'people', function (Blueprint $table) { |
| 59 | + $table->string('title', 255)->nullable()->change(); |
| 60 | + $table->string('first_name', 255)->change(); |
| 61 | + $table->string('middle_name', 255)->nullable()->change(); |
| 62 | + $table->string('last_name', 255)->nullable()->change(); |
| 63 | + $table->string('maiden_name', 255)->nullable()->change(); |
| 64 | + }); |
| 65 | + |
| 66 | + Schema::table(config('laravel-crm.db_table_prefix').'organisations', function (Blueprint $table) { |
| 67 | + $table->string('name', 1000)->nullable()->change(); |
| 68 | + }); |
| 69 | + |
| 70 | + Schema::table(config('laravel-crm.db_table_prefix').'addresses', function (Blueprint $table) { |
| 71 | + $table->string('address', 255)->nullable()->change(); |
| 72 | + $table->string('line1', 255)->change(); |
| 73 | + $table->string('line2', 255)->nullable()->change(); |
| 74 | + $table->string('line3', 255)->nullable()->change(); |
| 75 | + $table->string('code', 255)->nullable()->change(); |
| 76 | + $table->string('city', 255)->nullable()->change(); |
| 77 | + $table->string('state', 255)->nullable()->change(); |
| 78 | + $table->string('country', 255)->nullable()->change(); |
| 79 | + }); |
| 80 | + |
| 81 | + Schema::table(config('laravel-crm.db_table_prefix').'emails', function (Blueprint $table) { |
| 82 | + $table->string('address', 255)->nullable()->change(); |
| 83 | + }); |
| 84 | + |
| 85 | + Schema::table(config('laravel-crm.db_table_prefix').'phones', function (Blueprint $table) { |
| 86 | + $table->string('number', 255)->nullable()->change(); |
| 87 | + }); |
| 88 | + } |
| 89 | + } |
| 90 | +} |
0 commit comments