|
| 1 | +<?php |
| 2 | + |
| 3 | +use Illuminate\Database\Migrations\Migration; |
| 4 | +use Illuminate\Database\Schema\Blueprint; |
| 5 | +use Illuminate\Support\Facades\Schema; |
| 6 | + |
| 7 | +return new class extends Migration |
| 8 | +{ |
| 9 | + public function up(): void |
| 10 | + { |
| 11 | + Schema::table('alert_rules', function (Blueprint $table) { |
| 12 | + $table->string('extra')->default('{}')->change(); |
| 13 | + $table->text('builder')->default('{}')->change(); |
| 14 | + $table->text('query')->default('')->change(); |
| 15 | + }); |
| 16 | + |
| 17 | + Schema::table('bills', function (Blueprint $table) { |
| 18 | + foreach ([ |
| 19 | + 'rate_95th_in', 'rate_95th_out', 'rate_95th', |
| 20 | + 'total_data', 'total_data_in', 'total_data_out', |
| 21 | + 'rate_average_in', 'rate_average_out', 'rate_average', |
| 22 | + ] as $col) { |
| 23 | + $table->bigInteger($col)->default(0)->change(); |
| 24 | + } |
| 25 | + $table->string('dir_95th', 3)->default('in')->change(); |
| 26 | + $table->dateTime('bill_last_calc')->default('1970-01-01 00:00:00')->change(); |
| 27 | + $table->string('bill_custid', 64)->default('')->change(); |
| 28 | + $table->string('bill_ref', 64)->default('')->change(); |
| 29 | + $table->string('bill_notes', 256)->default('')->change(); |
| 30 | + $table->boolean('bill_autoadded')->default(0)->change(); |
| 31 | + }); |
| 32 | + |
| 33 | + Schema::table('users', function (Blueprint $table) { |
| 34 | + $table->string('realname', 64)->default('')->change(); |
| 35 | + $table->string('email', 64)->default('')->change(); |
| 36 | + $table->char('descr', 30)->default('')->change(); |
| 37 | + }); |
| 38 | + } |
| 39 | + |
| 40 | + public function down(): void |
| 41 | + { |
| 42 | + Schema::table('alert_rules', function (Blueprint $table) { |
| 43 | + $table->string('extra')->change(); |
| 44 | + $table->text('builder')->change(); |
| 45 | + $table->text('query')->change(); |
| 46 | + }); |
| 47 | + |
| 48 | + Schema::table('bills', function (Blueprint $table) { |
| 49 | + foreach ([ |
| 50 | + 'rate_95th_in', 'rate_95th_out', 'rate_95th', |
| 51 | + 'total_data', 'total_data_in', 'total_data_out', |
| 52 | + 'rate_average_in', 'rate_average_out', 'rate_average', |
| 53 | + ] as $col) { |
| 54 | + $table->bigInteger($col)->change(); |
| 55 | + } |
| 56 | + $table->string('dir_95th', 3)->change(); |
| 57 | + $table->dateTime('bill_last_calc')->change(); |
| 58 | + $table->string('bill_custid', 64)->change(); |
| 59 | + $table->string('bill_ref', 64)->change(); |
| 60 | + $table->string('bill_notes', 256)->change(); |
| 61 | + $table->boolean('bill_autoadded')->change(); |
| 62 | + }); |
| 63 | + |
| 64 | + Schema::table('users', function (Blueprint $table) { |
| 65 | + $table->string('realname', 64)->change(); |
| 66 | + $table->string('email', 64)->change(); |
| 67 | + $table->char('descr', 30)->change(); |
| 68 | + }); |
| 69 | + } |
| 70 | +}; |
0 commit comments