-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [TM-1460] add migration to add index * [TM-1460] add index to polygon geometry and validate overlapping with bbox * [TM-1460] lint * [TM-1460] add overlap check with bboxes * [TM-1523] finish bbox precalculus for overlapping check * [TM-1523] add index to sitepolygon * [TM-1523] add initial factory with non empty geometry,for index
- Loading branch information
1 parent
9bb6341
commit 9fa19bf
Showing
5 changed files
with
96 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
database/migrations/2024_11_26_154102_add_spatial_index_to_polygon_geometry.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddSpatialIndexToPolygonGeometry extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('polygon_geometry', function (Blueprint $table) { | ||
DB::statement('ALTER TABLE polygon_geometry MODIFY COLUMN geom GEOMETRY NOT NULL'); | ||
DB::statement('CREATE SPATIAL INDEX polygon_geometry_geom_spatial_idx ON polygon_geometry (geom)'); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
Schema::table('polygon_geometry', function (Blueprint $table) { | ||
DB::statement('DROP INDEX polygon_geometry_geom_spatial_idx ON polygon_geometry'); | ||
DB::statement('ALTER TABLE polygon_geometry MODIFY COLUMN geom GEOMETRY NULL'); | ||
}); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
database/migrations/2024_11_28_200341_add_index_to_site_polygon_poly_id.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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::table('site_polygon', function (Blueprint $table) { | ||
$table->index('poly_id', 'idx_site_polygon_poly_id'); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table('site_polygon', function (Blueprint $table) { | ||
$table->dropIndex('idx_site_polygon_poly_id'); | ||
}); | ||
} | ||
}; |