Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from 4.X to 5.0.0 breaks SRID #181

Open
khalyomede opened this issue Nov 26, 2021 · 2 comments
Open

Migration from 4.X to 5.0.0 breaks SRID #181

khalyomede opened this issue Nov 26, 2021 · 2 comments

Comments

@khalyomede
Copy link

I just migrated from 4.X to 5.0.0, my static analyzer noticed there is not more 3rd srid parameter in constructor of Point, but how to specify it then? Is it a default on the model?

Currently this produces this error when I create a factory of my model:

SQLSTATE[HY000]: General error: 3643 The SRID of the geometry does not match the SRID of the column 'geo'. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column. (SQL: insert into `locations` (`address`, `geo`, `is_active`, `category_id`, `updated_at`, `created_at`) values ("6706 Alec Hills\nConroyland, TX 79751-2938", ST_GeomFromText(POINT(162.797666 53.388044)), 1, 1, 2021-11-26 16:50:20, 2021-11-26 16:50:20))

And my migration specified the SRID:

use App\Constants\Espg;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLocationsTable extends Migration
{
  public function up(): void
  {
    Schema::create('locations', function (Blueprint $table) {
      $table->point('geo', Espg::WSG84); // 4326
    });
  }

  public function down(): void
  {
    Schema::dropIfExists('locations');
  }
}
@dalabarge
Copy link

dalabarge commented Jan 14, 2022

Somehow this package force pushed old code over top of newer code when tagging release 5.0.0. You can see this in the history of tag 4.0.0 showing the Point.php file was updated 2 years ago while in 5.0.0 it is now showing 4 years ago. The 5.0.0 release is a regression release and should not be used until it is tagged with a more stable progressive release. Have to revert to 4.0.0.

@khalyomede
Copy link
Author

Thanks @dalabarge, that's what I ended up doing and I just skipped this package from composer outdated for the moment...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants