Skip to content

Migrate schemas

Migrate schemas #80

name: PGMQ Extension Upgrade
defaults:
run:
shell: bash
working-directory: ./
on:
pull_request:
branches:
- main
push:
branches:
- main
release:
types:
- created
jobs:
test:
name: Upgrade Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "pgmq-extension-test"
workspaces: |
pgmq
# Additional directories to cache
cache-directories: |
/home/runner/.pgrx
- uses: ./.github/actions/pgx-init
with:
working-directory: ./
- name: upgrade and test
run: |
sudo apt-get update && sudo apt-get install -y postgresql-server-dev-14
git clone https://github.com/pgpartman/pg_partman.git && \
cd pg_partman && \
sudo make install && cd ../
cp /usr/share/postgresql/14/extension/pg_partman* ~/.pgrx/15.4/pgrx-install/share/postgresql/extension/
cp /usr/lib/postgresql/14/lib/pg_partman_bgw.so ~/.pgrx/15.4/pgrx-install/lib/postgresql/
rm -rf ./target/pgrx-test-data-* || true
# Config
pg_version=$(stoml Cargo.toml features.default)
# Get current branch
export DATABASE_URL=postgres://$USER:postgres@localhost:28815/pgmq
export CI_BRANCH=$(git name-rev --name-only HEAD)
# Build and install old pgmq version
git fetch --tags
git checkout tags/v0.14.2
SQLX_OFFLINE=true cargo pgrx run ${pg_version} --pgcli || true
psql $DATABASE_URL -c "CREATE EXTENSION pg_partman;"
psql $DATABASE_URL -c "CREATE EXTENSION pgmq;"
psql $DATABASE_URL -c "select * from pgmq_create('test_queue_1')"
psql $DATABASE_URL -c "select * from pgmq_create_partitioned('test_partitioned_queue_1');"
# Checkout branch and attempt to update extension version
git checkout $CI_BRANCH
SQLX_OFFLINE=true cargo pgrx run ${pg_version} --pgcli || true
psql $DATABASE_URL -c "ALTER EXTENSION pgmq UPDATE;"
# Run extension tests
SQLX_OFFLINE=true cargo pgrx test ${pg_version}