Merge pull request #4078 from omnivore-app/fix/create-index-on-topic-concurrently

create index concurrently on topic column in library_item table
This commit is contained in:
Hongbo Wu
2024-06-19 12:09:17 +08:00
committed by GitHub
8 changed files with 38 additions and 5 deletions

View File

@ -1,4 +1,4 @@
name: Run tests
name: Build Docker Images
on:
push:
branches:

21
.github/workflows/lint-migrations.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Lint Migrations
on:
pull_request:
paths:
- 'packages/db/migrations/**'
jobs:
lint_migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Find modified migrations
run: |
modified_migrations=$(git diff --diff-filter=d --name-only origin/$GITHUB_BASE_REF...origin/$GITHUB_HEAD_REF 'packages/db/migrations/*.do.*.sql')
echo "$modified_migrations"
echo "::set-output name=file_names::$modified_migrations"
id: modified-migrations
- uses: sbdchd/squawk-action@v1
with:
pattern: ${{ steps.modified-migrations.outputs.file_names }}

View File

@ -77,6 +77,7 @@ jobs:
PG_PASSWORD: postgres
PG_DB: omnivore_test
PGPASSWORD: postgres # This is required for the psql command to work without a password prompt
PG_EXTRA_OPTIONS: '-c lock_timeout=2000'
- name: TypeScript Build and Lint
run: |
source ~/.nvm/nvm.sh

View File

@ -39,6 +39,7 @@ const getEnv = (): DBEnv => {
database: database || 'omnivore',
username,
password,
options: process.env.PG_EXTRA_OPTIONS,
}
return config

View File

@ -87,6 +87,4 @@ ALTER TABLE omnivore.library_item
ADD COLUMN topic LTREE,
ADD COLUMN score FLOAT;
CREATE INDEX library_item_topic_idx ON omnivore.library_item USING GIST (topic);
COMMIT;

View File

@ -9,8 +9,6 @@ DROP TABLE omnivore.public_item_stats;
DROP TABLE omnivore.public_item;
DROP TABLE omnivore.public_item_source;
DROP INDEX omnivore.library_item_topic_idx;
ALTER TABLE omnivore.library_item
DROP COLUMN seen_at,
DROP COLUMN digested_at,

View File

@ -0,0 +1,5 @@
-- Type: DO
-- Name: library_item_topic_idx
-- Description: Create index on topic column in library_item table
CREATE INDEX CONCURRENTLY IF NOT EXISTS library_item_topic_idx ON omnivore.library_item USING GIST (topic);

View File

@ -0,0 +1,9 @@
-- Type: UNDO
-- Name: library_item_topic_idx
-- Description: Create index on topic column in library_item table
BEGIN;
DROP INDEX IF EXISTS omnivore.library_item_topic_idx;
COMMIT;