diff --git a/backend/dissemination/api_versions.py b/backend/dissemination/api_versions.py index 574f015b0..56e209f9c 100644 --- a/backend/dissemination/api_versions.py +++ b/backend/dissemination/api_versions.py @@ -7,7 +7,7 @@ # These are API versions we want live. live = { - "dissemination": ["api_v1_0_3", "api_v1_1_0", "api_v1_1_1"], + "dissemination": ["api_v1_0_3", "api_v1_1_0"], "support": ["admin_api_v1_1_0"], } @@ -47,20 +47,6 @@ def exec_sql(location, version, filename): curs.execute(sql) -def create_materialized_view(location): - """ - Create or recreate the dissemination_combined materialized view. - We only want this done once on startup, regardless of the API version. - """ - conn = connection(get_conn_string()) - conn.autocommit = True - with conn.cursor() as curs: - path = f"{location}/sql/create_materialized_views.sql" - logger.info("EXEC SQL create_materialized_views.sql") - sql = open(path, "r").read() - curs.execute(sql) - - def create_views(location, version): exec_sql(location, version, "create_views.sql") diff --git a/backend/dissemination/management/commands/create_api_views.py b/backend/dissemination/management/commands/create_api_views.py index 4db39d481..105b87a78 100644 --- a/backend/dissemination/management/commands/create_api_views.py +++ b/backend/dissemination/management/commands/create_api_views.py @@ -8,7 +8,6 @@ class Command(BaseCommand): """ def handle(self, *args, **kwargs): - api_versions.create_materialized_view("dissemination") api_versions.create_functions("dissemination") api_versions.create_functions("support") api_versions.create_live_views("dissemination") diff --git a/backend/dissemination/management/commands/materialized_views.py b/backend/dissemination/management/commands/materialized_views.py index 11c0b8ab1..67acc95b5 100644 --- a/backend/dissemination/management/commands/materialized_views.py +++ b/backend/dissemination/management/commands/materialized_views.py @@ -15,10 +15,7 @@ def add_arguments(self, parser): def handle(self, *args, **options): path = "dissemination/sql" if options["create"]: - # Other API views may rely on the materialized view. So, drop and recreate them. - api_versions.drop_live_views("dissemination") api_versions.exec_sql_at_path(path, "create_materialized_views.sql") - api_versions.create_live_views("dissemination") elif options["drop"]: api_versions.exec_sql_at_path(path, "drop_materialized_views.sql") elif options["refresh"]: diff --git a/backend/docker-compose-web.yml b/backend/docker-compose-web.yml index f7f9c6017..98deabef2 100644 --- a/backend/docker-compose-web.yml +++ b/backend/docker-compose-web.yml @@ -99,7 +99,7 @@ services: PGRST_OPENAPI_SERVER_PROXY_URI: http://127.0.0.1:3000 PGRST_DB_ANON_ROLE: anon # See https://postgrest.org/en/stable/references/api/schemas.html#multiple-schemas for multiple schemas - PGRST_DB_SCHEMAS: "api_v1_0_3, api_v1_1_0, api_v1_1_1, admin_api_v1_1_0" + PGRST_DB_SCHEMAS: "api_v1_0_3, api_v1_1_0, admin_api_v1_1_0" PGRST_JWT_SECRET: ${PGRST_JWT_SECRET:-32_chars_fallback_secret_testing} # Fallback value for testing environments depends_on: db: diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index ace79bc28..f8ee53cad 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -126,7 +126,7 @@ services: PGRST_OPENAPI_SERVER_PROXY_URI: http://127.0.0.1:3000 PGRST_DB_ANON_ROLE: anon # See https://postgrest.org/en/stable/references/api/schemas.html#multiple-schemas for multiple schemas - PGRST_DB_SCHEMAS: "api_v1_0_3, api_v1_1_0, api_v1_1_1, admin_api_v1_1_0" + PGRST_DB_SCHEMAS: "api_v1_0_3, api_v1_1_0, admin_api_v1_1_0" PGRST_JWT_SECRET: ${PGRST_JWT_SECRET:-32_chars_fallback_secret_testing} # Fallback value for testing environments # Enable this to inspect the DB plans for queries via EXPLAIN PGRST_DB_PLAN_ENABLED: ${PGRST_DB_PLAN_ENABLED:-false} diff --git a/terraform/shared/modules/env/postgrest.tf b/terraform/shared/modules/env/postgrest.tf index 7cb705c58..0d0c4d7b6 100644 --- a/terraform/shared/modules/env/postgrest.tf +++ b/terraform/shared/modules/env/postgrest.tf @@ -32,7 +32,7 @@ resource "cloudfoundry_app" "postgrest" { environment = { PGRST_DB_URI : cloudfoundry_service_key.postgrest.credentials.uri - PGRST_DB_SCHEMAS : "api_v1_0_3,api_v1_1_0,api_v1_1_1,admin_api_v1_1_0" + PGRST_DB_SCHEMAS : "api_v1_0_3,api_v1_1_0,admin_api_v1_1_0" PGRST_DB_ANON_ROLE : "anon" PGRST_JWT_SECRET : var.pgrst_jwt_secret PGRST_DB_MAX_ROWS : 20000