| @@ 12-26 (lines=15) @@ | ||
| 9 | * |
|
| 10 | * @return void |
|
| 11 | */ |
|
| 12 | public function up() |
|
| 13 | { |
|
| 14 | Schema::table('notifications', function ($table) { |
|
| 15 | $driver = Config::get('database.driver'); |
|
| 16 | ||
| 17 | if ($driver === 'mysql' || $driver === 'sqlite') { |
|
| 18 | DB::statement('ALTER TABLE notifications MODIFY COLUMN extra json'); |
|
| 19 | } elseif ($driver === 'pgsql') { |
|
| 20 | DB::statement('ALTER TABLE notifications ALTER COLUMN extra TYPE json USING code::string'); |
|
| 21 | } |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Reverse the migrations. |
|
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| @@ 30-45 (lines=16) @@ | ||
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | public function down() |
|
| 31 | { |
|
| 32 | Schema::table('notifications', function ($table) { |
|
| 33 | $driver = Config::get('database.driver'); |
|
| 34 | ||
| 35 | if ($driver === 'mysql' || $driver === 'sqlite') { |
|
| 36 | DB::statement('ALTER TABLE notifications MODIFY COLUMN extra STRING(255)'); |
|
| 37 | } elseif ($driver === 'pgsql') { |
|
| 38 | DB::statement('ALTER TABLE notifications ALTER COLUMN extra TYPE string USING code::json'); |
|
| 39 | } |
|
| 40 | }); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||