From aa9d0a11edd58a31fcca0d0fce856155e5b389d5 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Thu, 13 Jul 2023 15:34:12 -0300 Subject: [PATCH] Enable pgvector in postgres template (#724) --- image/discourse_dev/postgres_dev.template.yml | 3 +++ templates/postgres.13.template.yml | 2 ++ templates/postgres.template.yml | 2 ++ 3 files changed, 7 insertions(+) diff --git a/image/discourse_dev/postgres_dev.template.yml b/image/discourse_dev/postgres_dev.template.yml index 2092d03..fd257f2 100644 --- a/image/discourse_dev/postgres_dev.template.yml +++ b/image/discourse_dev/postgres_dev.template.yml @@ -28,18 +28,21 @@ run: - exec: su postgres -c 'psql discourse_development -c "alter schema public owner to discourse;"' - exec: su postgres -c 'psql discourse_development -c "create extension if not exists hstore;"' - exec: su postgres -c 'psql discourse_development -c "create extension if not exists pg_trgm;"' + - exec: su postgres -c 'psql discourse_development -c "create extension if not exists vector;"' - exec: su postgres -c 'createdb discourse_test' || true - exec: su postgres -c 'psql discourse_test -c "grant all privileges on database discourse_test to discourse;"' || true - exec: su postgres -c 'psql discourse_test -c "alter schema public owner to discourse;"' - exec: su postgres -c 'psql discourse_test -c "create extension if not exists hstore;"' - exec: su postgres -c 'psql discourse_test -c "create extension if not exists pg_trgm;"' + - exec: su postgres -c 'psql discourse_test -c "create extension if not exists vector;"' - exec: su postgres -c 'createdb discourse_test_multisite' || true - exec: su postgres -c 'psql discourse_test_multisite -c "grant all privileges on database discourse_test_multisite to discourse;"' || true - exec: su postgres -c 'psql discourse_test_multisite -c "alter schema public owner to discourse;"' - exec: su postgres -c 'psql discourse_test_multisite -c "create extension if not exists hstore;"' - exec: su postgres -c 'psql discourse_test_multisite -c "create extension if not exists pg_trgm;"' + - exec: su postgres -c 'psql discourse_test_multisite -c "create extension if not exists vector;"' - exec: cd tmp && git clone https://github.com/discourse/discourse.git --depth=1 - exec: chown -R discourse /tmp/discourse diff --git a/templates/postgres.13.template.yml b/templates/postgres.13.template.yml index a5f13b8..bb2c0a2 100644 --- a/templates/postgres.13.template.yml +++ b/templates/postgres.13.template.yml @@ -213,8 +213,10 @@ run: - exec: su postgres -c 'psql $db_name -c "alter schema public owner to $db_user;"' - exec: su postgres -c 'psql template1 -c "create extension if not exists hstore;"' - exec: su postgres -c 'psql template1 -c "create extension if not exists pg_trgm;"' + - exec: su postgres -c 'psql template1 -c "create extension if not exists vector;"' - exec: su postgres -c 'psql $db_name -c "create extension if not exists hstore;"' - exec: su postgres -c 'psql $db_name -c "create extension if not exists pg_trgm;"' + - exec: su postgres -c 'psql $db_name -c "create extension if not exists vector;"' - exec: stdin: | update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = '$db_name' AND encoding = pg_char_to_encoding('SQL_ASCII'); diff --git a/templates/postgres.template.yml b/templates/postgres.template.yml index a5f13b8..bb2c0a2 100644 --- a/templates/postgres.template.yml +++ b/templates/postgres.template.yml @@ -213,8 +213,10 @@ run: - exec: su postgres -c 'psql $db_name -c "alter schema public owner to $db_user;"' - exec: su postgres -c 'psql template1 -c "create extension if not exists hstore;"' - exec: su postgres -c 'psql template1 -c "create extension if not exists pg_trgm;"' + - exec: su postgres -c 'psql template1 -c "create extension if not exists vector;"' - exec: su postgres -c 'psql $db_name -c "create extension if not exists hstore;"' - exec: su postgres -c 'psql $db_name -c "create extension if not exists pg_trgm;"' + - exec: su postgres -c 'psql $db_name -c "create extension if not exists vector;"' - exec: stdin: | update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = '$db_name' AND encoding = pg_char_to_encoding('SQL_ASCII'); -- 2.25.1