Learnings
New Learning
About The App
Hire Me
Writing Samples
Edit Learning
Title
Body
Context: I needed to run initial database migrations (`rails db:migrate`) on Render's free tier, which lacks Shell access or explicit Pre-Deploy/Post-Deploy command support. Migrations must run after the code is deployed and dependencies installed but before the server starts taking requests based on the new schema. Resolution (Workaround): I temporarily added `bundle exec rails db:migrate` to the *end* of the Build Command in Render settings for the first successful deployment (e.g., `bundle install; bundle exec rails assets:precompile; bundle exec rails db:migrate`). Learning: On restricted environments (like PaaS free tiers), essential post-deploy tasks like database migrations might need temporary workarounds, such as including them at the end of the build command. I learned to remember to remove the migration step from the build command after the first successful run to avoid unnecessary migrations on subsequent deploys and potentially slow down builds. Considering using release phase tasks if the platform supports them (Render paid tiers do) is a good idea for the future.
Learned on (YYYY-MM-DD)
Tags
Add comma-separated tags. They help filter learnings later.
Back to Learnings