| 1 | package DBIO::PostgreSQL::PostGIS::Deploy; | ||
| 2 | # ABSTRACT: Deploy orchestrator for PostGIS-enabled PostgreSQL schemas | ||
| 3 | |||
| 4 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 3 | ▶ | use base 'DBIO::PostgreSQL::Deploy'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 3 | ▶ | use DBIO::PostgreSQL::PostGIS::Introspect; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | |||
| 12 | 0 | ▶ | sub _introspect_class { 'DBIO::PostgreSQL::PostGIS::Introspect' } |
|
Subroutine
_introspect_class: not called CC=1 SCAR=6.9
| |||
| 13 | |||
| 14 | |||
| 15 | 3 | 1; | |
| 16 | |||
| 17 | __END__ | ||
| 18 | |||
| 19 | =pod | ||
| 20 | |||
| 21 | =encoding UTF-8 | ||
| 22 | |||
| 23 | =head1 NAME | ||
| 24 | |||
| 25 | DBIO::PostgreSQL::PostGIS::Deploy - Deploy orchestrator for PostGIS-enabled PostgreSQL schemas | ||
| 26 | |||
| 27 | =head1 VERSION | ||
| 28 | |||
| 29 | version 0.900001 | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | Subclass of L<DBIO::PostgreSQL::Deploy> that swaps in | ||
| 34 | L<DBIO::PostgreSQL::PostGIS::Introspect> so geometry column metadata | ||
| 35 | (C<geometry_type>, C<srid>) is correctly captured during both live-DB | ||
| 36 | and temp-DB introspection. | ||
| 37 | |||
| 38 | Activated automatically when L<DBIO::PostgreSQL::PostGIS::Storage> is | ||
| 39 | the active storage class via C<dbio_deploy_class>. | ||
| 40 | |||
| 41 | The orchestration itself (install/apply/upgrade/diff, temp-database | ||
| 42 | lifecycle) is inherited unchanged from L<DBIO::PostgreSQL::Deploy>, which | ||
| 43 | in turn derives from L<DBIO::Deploy::Base::TempDatabase>. This class only | ||
| 44 | swaps the introspector via L</_introspect_class>. | ||
| 45 | |||
| 46 | B<Deploying geometry columns:> C<diff> builds its target model by | ||
| 47 | deploying the schema into a freshly created temp database. That database | ||
| 48 | does not inherit the PostGIS extension, so a schema with C<geometry>/ | ||
| 49 | C<geography> columns must declare the extension so the install DDL emits | ||
| 50 | C<CREATE EXTENSION>: | ||
| 51 | |||
| 52 | __PACKAGE__->pg_extensions('postgis'); | ||
| 53 | |||
| 54 | Without it the temp-database deploy fails with C<type "geometry" does not | ||
| 55 | exist>. | ||
| 56 | |||
| 57 | =head1 METHODS | ||
| 58 | |||
| 59 | =head2 _introspect_class | ||
| 60 | |||
| 61 | Override: returns L<DBIO::PostgreSQL::PostGIS::Introspect> so geometry | ||
| 62 | column metadata (C<geometry_type>, C<srid>) is captured during both | ||
| 63 | live-DB and temp-DB introspection. The inherited C<_new_introspect> | ||
| 64 | (from L<DBIO::PostgreSQL::Deploy>) instantiates this class with the | ||
| 65 | correct C<schema_filter> derived from C<< $schema->pg_schemas >>. | ||
| 66 | |||
| 67 | =head1 AUTHOR | ||
| 68 | |||
| 69 | DBIO Authors | ||
| 70 | |||
| 71 | =head1 COPYRIGHT AND LICENSE | ||
| 72 | |||
| 73 | Copyright (C) 2026 DBIO Authors | ||
| 74 | |||
| 75 | This is free software; you can redistribute it and/or modify it under | ||
| 76 | the same terms as the Perl 5 programming language system itself. | ||
| 77 | |||
| 78 | =cut | ||