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:
2
.github/workflows/build-docker-images.yml
vendored
2
.github/workflows/build-docker-images.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Run tests
|
||||
name: Build Docker Images
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
|
||||
21
.github/workflows/lint-migrations.yml
vendored
Normal file
21
.github/workflows/lint-migrations.yml
vendored
Normal 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 }}
|
||||
1
.github/workflows/run-tests.yaml
vendored
1
.github/workflows/run-tests.yaml
vendored
@ -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
|
||||
|
||||
@ -39,6 +39,7 @@ const getEnv = (): DBEnv => {
|
||||
database: database || 'omnivore',
|
||||
username,
|
||||
password,
|
||||
options: process.env.PG_EXTRA_OPTIONS,
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
5
packages/db/migrations/0183.do.library_item_topic_idx.sql
Executable file
5
packages/db/migrations/0183.do.library_item_topic_idx.sql
Executable 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);
|
||||
9
packages/db/migrations/0183.undo.library_item_topic_idx.sql
Executable file
9
packages/db/migrations/0183.undo.library_item_topic_idx.sql
Executable 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;
|
||||
Reference in New Issue
Block a user