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

Add IF NOT EXISTS conditions on indexes creation #778

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public function getDescription(): string

public function up(Schema $schema): void
{
$this->addSql('CREATE EXTENSION postgis');
$this->addSql('CREATE EXTENSION IF NOT EXISTS postgis');
}

public function down(Schema $schema): void
{
$this->addSql('DROP EXTENSION postgis');
$this->addSql('DROP EXTENSION IF EXISTS postgis');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function up(Schema $schema): void
$func$;
');

$this->addSql('CREATE INDEX voie_nommee_normalized_nom_minuscule_code_insee_idx ON voie_nommee (f_bdtopo_voie_nommee_normalize_nom_minuscule(nom_minuscule), code_insee);');
$this->addSql('CREATE INDEX route_numerotee_ou_nommee_numero_gestionnaire_idx ON route_numerotee_ou_nommee (numero, gestionnaire);');
$this->addSql('CREATE INDEX IF NOT EXISTS voie_nommee_normalized_nom_minuscule_code_insee_idx ON voie_nommee (f_bdtopo_voie_nommee_normalize_nom_minuscule(nom_minuscule), code_insee);');
$this->addSql('CREATE INDEX IF NOT EXISTS route_numerotee_ou_nommee_numero_gestionnaire_idx ON route_numerotee_ou_nommee (numero, gestionnaire);');
}

public function down(Schema $schema): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function getDescription(): string

public function up(Schema $schema): void
{
$this->addSql('CREATE INDEX point_de_repere_route_numero_gestionnaire_cote_idx ON point_de_repere (route, numero, gestionnaire, cote);');
$this->addSql('CREATE INDEX IF NOT EXISTS point_de_repere_route_numero_gestionnaire_cote_idx ON point_de_repere (route, numero, gestionnaire, cote);');
}

public function down(Schema $schema): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function getDescription(): string
public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE voie_nommee ADD COLUMN nom_minuscule_search tsvector GENERATED ALWAYS AS (to_tsvector('french', nom_minuscule)) STORED");
$this->addSql('CREATE INDEX voie_nommee_nom_minuscule_search_idx ON voie_nommee USING GIN(nom_minuscule_search)');
$this->addSql('CREATE INDEX voie_nommee_code_insee_idx ON voie_nommee (code_insee)');
$this->addSql('CREATE INDEX IF NOT EXISTS voie_nommee_nom_minuscule_search_idx ON voie_nommee USING GIN(nom_minuscule_search)');
$this->addSql('CREATE INDEX IF NOT EXISTS voie_nommee_code_insee_idx ON voie_nommee (code_insee)');
}

public function down(Schema $schema): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public function getDescription(): string

public function up(Schema $schema): void
{
$this->addSql('CREATE EXTENSION pg_trgm');
$this->addSql('CREATE EXTENSION IF NOT EXISTS pg_trgm');
}

public function down(Schema $schema): void
{
$this->addSql('DROP EXTENSION pg_trgm');
$this->addSql('DROP EXTENSION IF EXISTS pg_trgm');
}
}
Loading