Menu

Post image 1
Post image 2
1 / 2
0

Database Migrations & Seeders: Stop Writing Manual SQL Scripts

DEV Community·Umadhar M·about 1 month ago
#rKB3QYeJ
Reading 0:00
15s threshold

If you've ever said "I forgot to run the ALTER TABLE on production" — this post is for you. Manual database changes are one of the most common causes of production incidents. A developer adds a column locally, merges the feature, deploys — and the app crashes because nobody ran the SQL on the live server. Migrations and seeders solve this completely. But the tooling is different for every stack, and most guides only cover one framework. This one covers all of them . The Core Idea Instead of running SQL manually, you write versioned migration files as part of your normal code. They get reviewed in pull requests, committed to git, and run automatically during deployment. Nobody forgets a column again. Two concepts to understand: Migration — a versioned script for schema changes (CREATE TABLE, ALTER, ADD COLUMN). Applied once, tracked by the framework. Seeder — scripted insertion of reference or initial data. Always written to be idempotent — meaning it can run multiple times without duplicating data.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More