diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2302d53..04ddc83 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,26 +1,12 @@ name: run-tests -on: [push, pull_request] +on: + - push + - pull_request jobs: test: runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: ['8.0', 8.1, 8.2, 8.3] - laravel: [8, 9, 10, 11] - exclude: - - php: '8.0' - laravel: 10 - - php: '8.0' - laravel: 11 - - php: '8.2' - laravel: 8 - - php: '8.1' - laravel: 11 - - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} services: mysql: @@ -32,9 +18,21 @@ jobs: - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + strategy: + fail-fast: true + matrix: + php: ['8.0', 8.1, 8.2, 8.3] + laravel: [8, 9, 10] + stability: [prefer-lowest, prefer-stable] + exclude: + - php: '8.0' + laravel: 10 + + name: P${{ matrix.php }} - L${{ matrix.laravel }} + steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.gitignore b/.gitignore index 3700220..b9fc06e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /.idea /.phpunit.result.cache /composer.lock -/.phpunit.cache \ No newline at end of file +/.phpunit.cache +.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c5ac8f3..c696dc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to `laravel-spatial` will be documented in this file +## 2.1.0 - 2025-02-20 +- Removed support for Laravel 11 due to incompatibility with the current implementation. + ## 2.0.1 - 2024-11-27 - Fix the incorrect parameter count error while using `ST_SRID` functions with `MariaDB`. diff --git a/README.md b/README.md index 01ac98f..3ae760c 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ It supports only MySQL Spatial Data Types and Functions, other RDBMS is on the r | Version | Supported Laravel Versions | |---------|----------------------------| -| `2.x` | `^11.0` | -| `1.x` | `^8.0, ^9.0, ^10.0` | +| `3.x` | `^11.0`, `^12.0` | +| `2.x` | `^8.0, ^9.0, ^10.0` | **Supported data types:** - `Point` @@ -79,27 +79,6 @@ Schema::create('addresses', function (Blueprint $table) { $table->spatialIndex('location'); }) ``` -### For Laravel 11 and Above Versions - -From Laravel 11 onwards, migrations are created as follows: - -```php -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -return new class extends Migration { - - public function up(): void - { - Schema::create('addresses', function (Blueprint $table) { - $table->geography('location', 'point'); - }) - } - -} -``` -In Laravel 11, the methods **point**, **lineString**, **polygon**, **geometryCollection**, **multiPoint**, **multiLineString**, and **multiPolygon** have been removed. Therefore, we are updating to use the **geography** method instead. The `geography` method sets the default SRID value to 4326. #### Issue with adding a new location column with index to an existing table: When adding a new location column with an index in Laravel, it can be troublesome if you have existing data. One common mistake is trying to set a default value for the new column using `->default(new Point(0, 0, 4326))`. However, `POINT` columns cannot have a default value, which can cause issues when trying to add an index to the column, as indexed columns cannot be nullable. @@ -126,28 +105,6 @@ public function up() } ``` - -### For Laravel 11 and Above Versions - -```php -public function up() -{ - // Add the new location column as nullable - Schema::table('table', function (Blueprint $table) { - $table->geography('location', 'point')->nullable(); - }); - - // In the second go, set 0,0 values, make the column not null and finally add the spatial index - Schema::table('table', function (Blueprint $table) { - DB::statement("UPDATE `addresses` SET `location` = ST_GeomFromText('POINT(0 0)', 4326);"); - - DB::statement("ALTER TABLE `table` CHANGE `location` `location` POINT NOT NULL;"); - - $table->spatialIndex('location'); - }); -} -``` - *** ### 2- Models: