clickbar / laravel-magellan

A modern PostGIS toolbox for Laravel
MIT License
217 stars 13 forks source link

update-postgis-columns inserts code at top of the file #85

Open brausepulver opened 6 months ago

brausepulver commented 6 months ago

Running the command on a model with geometry columns in the database but no $postgisColumns inserts code at the top of the file outside of the class:

<?php

    protected array $postgisColumns = [
        'geog' => [
            'type' => 'geography',
            'srid' => 4326,
        ],
    ];

    use HasPostgisColumns;

This only happens when $postgisColumns is not present on the model. When $postgisColumns is present the column definitions are inserted correctly.

In other cases the command prompts to change code that is the exact same as the proposed code.

saibotk commented 6 months ago

Oh good catch sorry for the inconvenience, and thanks for filing the issue 👍

saibotk commented 3 months ago

Theoretically the array should be added below any traits or the line with class YourModel extends Model .....

Can you show me the beginning of your model file? With the same formatting etc?