Commit fb562dd9 authored by Luc Didry's avatar Luc Didry
Browse files

[postgresql] Add partial index to speed up some queries

parent 0e63bf76
Revision history for Lutim
????? ??????????
- PostgreSQL performance improvments
0.9.6 2018-03-12
- Update translations
......
......@@ -18,9 +18,9 @@ sub register {
# Database migration
my $migrations = Mojo::Pg::Migrations->new(pg => $app->pg);
if ($app->mode eq 'development' && $ENV{LUTIM_DEBUG}) {
$migrations->from_file('utilities/migrations/postgresql.sql')->migrate(0)->migrate(2);
$migrations->from_file('utilities/migrations/postgresql.sql')->migrate(0)->migrate(3);
} else {
$migrations->from_file('utilities/migrations/postgresql.sql')->migrate(2);
$migrations->from_file('utilities/migrations/postgresql.sql')->migrate(3);
}
} elsif ($app->config('dbtype') eq 'sqlite') {
# SQLite database migration if needed
......
......@@ -22,3 +22,7 @@ DROP TABLE lutim;
ALTER TABLE lutim ADD COLUMN iv text;
-- 2 down
ALTER TABLE lutim DROP COLUMN iv;
-- 3 up
CREATE INDEX IF NOT EXISTS empty_short_idx ON lutim (short) WHERE path IS NULL;
-- 3 down
DROP INDEX empty_short_idx;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment