| 1: | <?php |
| 2: | |
| 3: | use Aurora\Modules\Core\Models\User; |
| 4: | use Aurora\Modules\Core\Module as CoreModule; |
| 5: | use Illuminate\Database\Migrations\Migration; |
| 6: | use Illuminate\Database\Schema\Blueprint; |
| 7: | use Illuminate\Database\Capsule\Manager as Capsule; |
| 8: | |
| 9: | class AlterUsersTableUpdateTimeformatColumn extends Migration |
| 10: | { |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | public function up() |
| 17: | { |
| 18: | User::where('TimeFormat', null) |
| 19: | ->update([ |
| 20: | 'TimeFormat' => CoreModule::getInstance()->getModuleSettings()->TimeFormat |
| 21: | ]); |
| 22: | |
| 23: | Capsule::schema()->table('core_users', function (Blueprint $table) { |
| 24: | $table->integer('TimeFormat')->nullable(false)->change(); |
| 25: | }); |
| 26: | } |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public function down() |
| 34: | { |
| 35: | Capsule::schema()->table('core_users', function (Blueprint $table) { |
| 36: | $table->integer('TimeFormat')->nullable()->change(); |
| 37: | }); |
| 38: | } |
| 39: | } |
| 40: | |