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 support for covering index (INCLUDE) on PG producer #131

Merged
merged 7 commits into from Aug 9, 2021
Merged
4 changes: 2 additions & 2 deletions t/47postgres-producer.t
Expand Up @@ -656,11 +656,11 @@ is($view2_sql1, $view2_sql_replace, 'correct "CREATE OR REPLACE VIEW" SQL 2');
}

{
my $index = $table->add_index(name => 'covering', fields => ['bar'], options => { include => [ 'lower(foo)' ] });
my $index = $table->add_index(name => 'covering', fields => ['bar'], options => { include => [ 'lower(foo)', 'baz' ] });
my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index);
is($def, "CREATE INDEX covering on foobar (bar)", 'skip if postgres is too old');
($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, { postgres_version => 11 });
is($def, "CREATE INDEX covering on foobar (bar) INCLUDE (lower(foo))", 'index created');
is($def, "CREATE INDEX covering on foobar (bar) INCLUDE (lower(foo), baz)", 'index created');
}

{
Expand Down