pg 17 upgrade

This commit is contained in:
Dylan Knutson
2025-07-22 23:04:58 +00:00
parent 8d65c2514a
commit 295020a10f
10 changed files with 279 additions and 417 deletions

View File

@@ -51,7 +51,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
sudo apt update && \
sudo apt-get install --no-install-recommends --no-install-suggests -qqy \
postgresql-client-15
postgresql-client-17
# Install & configure delta diff tool
RUN wget -O- https://github.com/dandavison/delta/releases/download/0.18.2/git-delta_0.18.2_amd64.deb > /tmp/git-delta.deb && \

View File

@@ -1,8 +1,7 @@
FROM postgres:15
FROM postgres:17
RUN apt-get update && apt-get install -y \
postgresql-15-pgvector \
postgresql-17-pgvector \
&& rm -rf /var/lib/apt/lists/*
COPY create-tablespaces.bash /docker-entrypoint-initdb.d/00-create-tablespaces.bash
RUN echo "CREATE EXTENSION pgvector;" >> /docker-entrypoint-initdb.d/01-pgvector.sql
RUN echo "CREATE EXTENSION vector;" >> /docker-entrypoint-initdb.d/01-vector.sql

View File

@@ -1,9 +0,0 @@
#!/bin/bash -ex
mkdir -p /tablespaces/mirai
chown postgres:postgres /tablespaces/mirai
chmod 750 /tablespaces/mirai
psql -v ON_ERROR_STOP=1 \
--username "$POSTGRES_USER" \
--dbname "$POSTGRES_DB" \
-c "CREATE TABLESPACE mirai LOCATION '/tablespaces/mirai'"

View File

@@ -23,8 +23,7 @@ services:
dockerfile: Dockerfile.postgres
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
- postgres-data-tablespaces:/tablespaces
- postgres-17-data:/var/lib/postgresql/data
- ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql
environment:
POSTGRES_USER: postgres
@@ -66,8 +65,7 @@ services:
- devcontainer-redux-grafana-data:/var/lib/grafana
volumes:
postgres-data:
postgres-data-tablespaces:
postgres-17-data:
devcontainer-redux-gem-cache:
devcontainer-redux-blob-files:
devcontainer-redux-grafana-data:

View File

@@ -1,7 +1,7 @@
---
id: task-69
title: Update devcontainer Dockerfile based on has_aux_table repo
status: To Do
status: Done
assignee: []
created_date: '2025-07-21'
labels: []

View File

@@ -1,9 +1,3 @@
# SQLite. Versions 3.8.0 and up are supported.
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem "sqlite3"
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
@@ -28,9 +22,6 @@ redux_dev: &redux_dev
adapter: postgresql
host: db
port: 5432
# database: redux_development
# username: scraper_redux
# password: pdkFLqRmQwPUPaDDC4pX
database: postgres
username: postgres
password: postgres
@@ -41,8 +32,6 @@ local_redux_test: &local_redux_test
host: db
port: 5432
database: redux_test<%= ENV['TEST_ENV_NUMBER'] %>
# username: scraper_redux
# password: pdkFLqRmQwPUPaDDC4pX
username: postgres
password: postgres
pool: 4

View File

@@ -0,0 +1,9 @@
class DropIndexedPosts < ActiveRecord::Migration[7.2]
def up
drop_table :indexed_posts
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@@ -0,0 +1,17 @@
class MigrateEverythingOutOfMirai < ActiveRecord::Migration[7.2]
def up
execute <<-SQL
ALTER TABLE ALL IN TABLESPACE mirai
SET tablespace pg_default;
SQL
execute <<-SQL
ALTER INDEX ALL IN TABLESPACE mirai
SET tablespace pg_default;
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@@ -0,0 +1,13 @@
class DropMiraiTablespace < ActiveRecord::Migration[7.2]
disable_ddl_transaction!
def up
execute <<-SQL
DROP TABLESPACE mirai;
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

File diff suppressed because it is too large Load Diff