Skip to content

Commit

Permalink
Removed the Doctrine-based migration-workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Feb 28, 2024
1 parent d1b5d65 commit 16ec232
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
laravel: ['10.0', '10.39', '11.x']
laravel: ['10.0', '10.46', '11.x']
exclude:
- php: '8.1'
laravel: '11.x'
Expand All @@ -26,6 +26,10 @@ jobs:
- name: Lock Package Versions
run: |
composer require "laravel/framework:${{ matrix.laravel }}.*" --no-update -v
- name: Prevent Laravel 10 + Doctrine 4
run: |
is_smaller_version() [[ $(echo -e "$1\n$2"|sort -V|head -1) != $2 ]]
is_smaller_version "${{ matrix.laravel }}" "10.39" && composer req "doctrine/dbal:^3.5.1" --no-update || true
- name: Composer Install
run: composer install --prefer-dist --no-progress --no-interaction
- name: Create SQLite Database
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Added PHP 8.3 support
- Added Laravel 11 support
- Added Doctrine DBAL v4 support (required for Laravel 11)
- Removed the Doctrine based migration-workaround for modifying table with enum column that wasn't necessary after Laravel 6
- Changed minimum Enum version to v4.1
- BC: Changed all enum interfaces to extend the root `EnumInterface`
- BC: added the `iso2Code()` and the `getName()` methods to the `Country` interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,10 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Konekt\Address\Models\ProvinceTypeProxy;

class StreamlineProvincesTable extends Migration
{
/**
* With Laravel up to v5.8 renaming any column in a table that also has a column
* of type enum is not currently supported. This problem only seems to affect
* MySQL, this workaround provides a bit dirty but working solution for it
*
* @see https://laravel.com/docs/5.8/migrations#modifying-columns
* @see https://stackoverflow.com/q/33140860/1016746
*/
public function __construct()
{
$platform = DB::getDoctrineConnection()->getDatabasePlatform();

if (!$platform->hasDoctrineTypeMappingFor('enum')) {
$platform->registerDoctrineTypeMapping('enum', 'string');
}
}

public function up()
{
/** based on ISO 3166-2 https://en.wikipedia.org/wiki/ISO_3166-2 */
Expand Down

0 comments on commit 16ec232

Please sign in to comment.