Skip to content

Commit

Permalink
change to use replica db (#4530)
Browse files Browse the repository at this point in the history
* skip unstable

* STG //  Fix RDI import dmd json field (#4504)

* fix rdi import dmd data json

* add migration

* fix test

* imports

* more fixes

* remove generateroles from upgrade, update generateroles based on admin history for these roles

* [STG] Payment Plan export xlsx: added FSP template doc types list (#4508)

* upd get_column_value_from_payment & fsp template doc types

* document_types ⭐

* fix 🌟

* Dashboard fix

* 215787_drop_cash_assist_migration_script_fix (#4509)

* 2226242_Payment_verification_page_not_accessible (#4514)

* add correct permission for cycles page

* fe fix

* just new line

* AB#226656 Error Cannot read properties of undefined Grievance ticket

* change to use replica db

* fix tests

---------

Co-authored-by: pavlo-mk <[email protected]>
Co-authored-by: Domenico <[email protected]>
Co-authored-by: Paulina Kujawa <[email protected]>
Co-authored-by: Paulina Kujawa <[email protected]>
Co-authored-by: Allan Stockman Rugano <[email protected]>
Co-authored-by: Marek Biczysko <[email protected]>
Co-authored-by: Allan Stockman RUGANO <[email protected]>
Co-authored-by: Maciej Szewczyk <[email protected]>
  • Loading branch information
9 people authored Dec 24, 2024
1 parent 9099556 commit c3adb14
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/helpers/.env-selenium
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ CELERY_RESULT_BACKEND=redis://redis:6379/0
CACHE_LOCATION=redis://redis:6379/1
CONSTANCE_REDIS_CONNECTION=redis://redis:6379/0
DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
REP_DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
USE_DUMMY_EXCHANGE_RATES=yes
CELERY_TASK_ALWAYS_EAGER=true
1 change: 1 addition & 0 deletions .github/helpers/.env-unit
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
REP_DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
POSTGRES_SSL_MODE=off
EMAIL_HOST=TBD
EMAIL_HOST_USER=TBD
Expand Down
1 change: 1 addition & 0 deletions development_tools/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ POSTGRES_PASS=postgres
PGUSER=postgres
POSTGRES_HOST_AUTH_METHOD=trust
DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
REP_DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
POSTGRES_SSL_MODE=off
EMAIL_HOST=TBD
EMAIL_HOST_USER=TBD
Expand Down
1 change: 1 addition & 0 deletions development_tools/local_selenium_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export POSTGRES_PASS=postgres
export PGUSER=postgres
export POSTGRES_HOST_AUTH_METHOD=trust
export DATABASE_URL=postgis://postgres:postgres@localhost:5432/postgres
export REP_DATABASE_URL=postgis://postgres:postgres@localhost:5432/postgres
export POSTGRES_SSL_MODE=off
export EMAIL_HOST=TBD
export EMAIL_HOST_USER=TBD
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2536,7 +2536,7 @@ type PaymentNode implements Node {
isCashAssist: Boolean!
followUps(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection!
householdSnapshot: PaymentHouseholdSnapshotNode
paymentVerification: PaymentVerificationNode
paymentVerifications(offset: Int, before: String, after: String, first: Int, last: Int): PaymentVerificationNodeConnection!
ticketComplaintDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketComplaintDetailsNodeConnection!
ticketSensitiveDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketSensitiveDetailsNodeConnection!
adminUrl: String
Expand Down
13 changes: 11 additions & 2 deletions src/frontend/src/__generated__/graphql.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/hct_mis_api/config/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"",
"https://django-environ.readthedocs.io/en/latest/types.html#environ-env-db-url",
),
"REP_DATABASE_URL": (
str,
"sqlite://",
"",
"",
"https://django-environ.readthedocs.io/en/latest/types.html#environ-env-db-url",
),
"DEBUG": (bool, False),
"ENV": (str, "dev"),
"DOMAIN": (str, "localhost:8000"),
Expand Down
10 changes: 1 addition & 9 deletions src/hct_mis_api/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from django.utils.translation import gettext_lazy as _

from single_source import get_version
from smart_env.exceptions import SmartEnvMissing

from hct_mis_api.config.env import env

Expand Down Expand Up @@ -110,15 +109,8 @@
else:
EMAIL_SUBJECT_PREFIX = ""

try:
REPLICA_DB = env("REP_DATABASE_URL", default=None)
except SmartEnvMissing:
REPLICA_DB = None

if REPLICA_DB:
RO_CONN = dict(**env.db("REP_DATABASE_URL")).copy()
else:
RO_CONN = dict(**env.db("DATABASE_URL")).copy()
RO_CONN = env.db("REP_DATABASE_URL")
RO_CONN.update(
{
"OPTIONS": {"options": "-c default_transaction_read_only=on"},
Expand Down

0 comments on commit c3adb14

Please sign in to comment.