8000 fixing shit for aurora · trenchantanalytics/postgres@14045e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 14045e7

Browse files
committed
fixing shit for aurora
1 parent b3e089c commit 14045e7

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

migrations/db/migrate.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ fi
2929
db=$( cd -- "$( dirname -- "$0" )" > /dev/null 2>&1 && pwd )
3030
if [ -z "${USE_DBMATE:-}" ]; then
3131
# run init scripts as postgres user
32-
for sql in "$db"/init-scripts/*.sql; do
33-
echo "$0: running $sql"
34-
psql -v ON_ERROR_STOP=1 --no-password --no-psqlrc -U postgres -f "$sql"
35-
done
32+
# for sql in "$db"/init-scripts/*.sql; do
33+
# echo "$0: running $sql"
34+
# psql -v ON_ERROR_STOP=1 --no-password --no-psqlrc -U postgres -f "$sql"
35+
# done
3636
psql -v ON_ERROR_STOP=1 --no-password --no-psqlrc -U postgres -c "ALTER USER supabase_admin WITH PASSWORD '$PGPASSWORD'"
3737
# run migrations as super user - postgres user demoted in post-setup
3838
for sql in "$db"/migrations/*.sql; do

migrations/db/migrations/10000000000000_demote-postgres.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ GRANT ALL ON ALL SEQUENCES IN SCHEMA extensions TO postgres;
1414
GRANT ALL ON ALL ROUTINES IN SCHEMA auth TO postgres;
1515
GRANT ALL ON ALL ROUTINES IN SCHEMA storage TO postgres;
1616
GRANT ALL ON ALL ROUTINES IN SCHEMA extensions TO postgres;
17-
ALTER ROLE postgres NOSUPERUSER CREATEDB CREATEROLE LOGIN REPLICATION BYPASSRLS;
18-
17+
ALTER ROLE postgres CREATEDB CREATEROLE LOGIN BYPASSRLS;
18+
GRANT NOSUPERUSER to postgres;
19+
GRANT rds_replication to postgres;
1920
-- migrate:down

migrations/db/migrations/20220713082019_pg_cron-pg_net-temp-perms-fix.sql

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ DO $$
33
DECLARE
44
pg_cron_installed boolean;
55
BEGIN
6-
-- checks if pg_cron is enabled
6+
-- checks if pg_cron is enabled
77
pg_cron_installed = (
8-
select count(*) = 1
9-
from pg_available_extensions
8+
select count(*) = 1
9+
from pg_available_extensions
1010
where name = 'pg_cron'
1111
and installed_version is not null
1212
);
@@ -27,7 +27,7 @@ BEGIN
2727
alter default privileges for user supabase_admin in schema cron grant all
2828
on functions to postgres with grant option;
2929

30-
grant all privileges on all tables in schema cron to postgres with grant option;
30+
grant all privileges on all tables in schema cron to postgres with grant option;
3131
END IF;
3232
END $$;
3333

@@ -37,22 +37,23 @@ DECLARE
3737
BEGIN
3838
-- checks if pg_net is enabled
3939
pg_net_installed = (
40-
select count(*) = 1
41-
from pg_available_extensions
40+
select count(*) = 1
41+
from pg_available_extensions
4242
where name = 'pg_net'
4343
and installed_version is not null
44-
44+
4545
);
4646

47-
IF pg_net_installed
47+
IF pg_net_installed
4848
THEN
4949
IF NOT EXISTS (
5050
SELECT 1
5151
FROM pg_roles
5252
WHERE rolname = 'supabase_functions_admin'
5353
)
5454
THEN
55-
CREATE USER supabase_functions_admin NOINHERIT CREATEROLE LOGIN NOREPLICATION;
55+
CREATE USER supabase_functions_admin NOINHERIT CREATEROLE LOGIN;
56+
REVOKE rds_replication FROM supabase_functions_admin;
5657
END IF;
5758

5859
GRANT USAGE ON SCHEMA net TO supabase_functions_admin, postgres, anon, authenticated, service_role;

0 commit comments

Comments
 (0)
0