Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE UNTIL TESTING COMPLETE chore: move orioledb to extensions schema #1448

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.0.1.039-orioledb"
postgres15: "15.8.1.045"
postgresorioledb-17: "17.0.1.040-orioledb-rc-1"
postgres15: "15.8.1.046-rc-1"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
7 changes: 5 additions & 2 deletions migrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,18 @@ Additionally, [supabase/postgres](https://github.com/supabase/postgres/blob/deve

### Add a Migration

First, start a local postgres server and apply the migrations

```shell
# Start the database server
docker-compose up
nix run .#dbmate-tool -- --version 15 --flake-url "."

# create a new migration
nix develop
dbmate new '<some message>'
```

Then, populate the migration at `./db/migrations/xxxxxxxxx_<some_message>` and make sure it execute sucessfully with
Then, execute the migration at `./db/migrations/xxxxxxxxx_<some_message>` and make sure it runs sucessfully with

```shell
dbmate up
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- migrate:up
do $$
declare
ext_schema text;
extensions_schema_exists boolean;
begin
-- check if the "extensions" schema exists
select exists (
select 1 from pg_namespace where nspname = 'extensions'
) into extensions_schema_exists;

if extensions_schema_exists then
-- check if the "orioledb" extension is in the "public" schema
select nspname into ext_schema
from pg_extension e
join pg_namespace n on e.extnamespace = n.oid
where extname = 'orioledb';

if ext_schema = 'public' then
execute 'alter extension orioledb set schema extensions';
end if;
end if;
end $$;

-- migrate:down

2 changes: 1 addition & 1 deletion migrations/schema-orioledb-17.sql
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CREATE SCHEMA vault;
-- Name: orioledb; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS orioledb WITH SCHEMA public;
CREATE EXTENSION IF NOT EXISTS orioledb WITH SCHEMA extensions;


--
Expand Down
Loading
Loading