Update deploy_database.sh#2601
Draft
Beatrys-lira wants to merge 1 commit into
Draft
Conversation
Contributor
Reviewer's GuideRefactors deploy_database.sh to infer and normalize database provider configuration, persist relevant environment variables into .env (including database connection URI), and run Prisma migrations using provider-specific schema and migration directories instead of the previous npm scripts and env_functions helper. Flow diagram for updated deploy_database.sh deployment logicflowchart TD
A[Start deploy_database.sh] --> B{DATABASE_PROVIDER set?}
B -- Yes --> C[PROVIDER = DATABASE_PROVIDER]
B -- No --> D[Read PROVIDER from .env DATABASE_PROVIDER]
C --> E[Normalize PROVIDER to lowercase]
D --> E[Normalize PROVIDER to lowercase]
E --> F{PROVIDER is psql_bouncer?}
F -- Yes --> G[PRISMA_PROVIDER = postgresql]
F -- No --> H[PRISMA_PROVIDER = PROVIDER]
G --> I[update_env for core vars
DATABASE_PROVIDER
DATABASE_ENABLED
SERVER_PORT
AUTHENTICATION_API_KEY
CACHE_REDIS_ENABLED
CACHE_LOCAL_ENABLED]
H --> I
I --> J{DATABASE_CONNECTION_URI set?}
J -- Yes --> K[update_env DATABASE_CONNECTION_URI from DATABASE_CONNECTION_URI]
J -- No --> L{DATABASE_CONNECTION_URL set?}
L -- Yes --> M[update_env DATABASE_CONNECTION_URI from DATABASE_CONNECTION_URL]
L -- No --> N{DATABASE_URL set?}
N -- Yes --> O[update_env DATABASE_CONNECTION_URI from DATABASE_URL]
N -- No --> P[Error: DATABASE_CONNECTION_URI not defined; exit 1]
K --> Q[Read DATABASE_CONNECTION_URI from .env into DB_URI]
M --> Q
O --> Q
Q --> R[rm -rf ./prisma/migrations]
R --> S[cp -r ./prisma/PRISMA_PROVIDER-migrations ./prisma/migrations]
S --> T[npx prisma migrate deploy --schema ./prisma/PRISMA_PROVIDER-schema.prisma]
T --> U[End: migrations applied]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Description
🔗 Related Issue
Closes #(issue_number)
🧪 Type of Change
🧪 Testing
📸 Screenshots (if applicable)
✅ Checklist
📝 Additional Notes
Summary by Sourcery
Update database deployment script to derive provider and connection URI from environment or .env and run Prisma migrations using provider-specific schemas and migrations.
Enhancements: