Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3489552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:24:30+00:00 2026-05-18T11:24:30+00:00

Based on reading around the web, stack overflow, and mostly these articles about db

  • 0

Based on reading around the web, stack overflow, and mostly these articles about db versioning that were linked from coding horror, I’ve made a stab at writing a plan for versioning the database of an 8 year old php mysql website.

Database Version Control plan
- Create a db as the "Master Database"
- Create a table db_version (id, script_name, version_number, author, comment, date_ran)   
- Create baseline script for schema+core data that creates this db from scratch, run this on Master Db
- Create a "test data" script to load any db with working data
- Modifications to the master db are ONLY to be made through the db versioning process
- Ensure everyone developing against the Master Db has a local db created by the baseline script
- Procedures for commiting and updating from the Master Db
    - Master Db Commit
        - Perform a schema diff between your local db and the master db
        - Perform a data diff on core data between your local db and master db
        - If there are changes in either or both cases, combine these changes into an update script
        - Collect the data to be added to a new row in db_version table, and add an insert for this into the script
            - new version number = latest master db version number +1
            - author
            - comment
        - The script must be named as changeScript_V.sql where V is the latest master db version +1
        - Run the script against the master db
        - If the script executed succesfully, add it to the svn repository
        - Add the new db_version record to your local db_version table      
    - Update from Master Db
        - Update your local svn checkout to have all the latest change scripts available
        - compares your local db_version table to the master db_version table to determine which change scripts to run
        - Run the required change scripts in order against your local db, which will also update your local db_version table

My first question is, does this sound correct?
My second question is, the commit process seems a bit complicated to do more than once a day. Is there a way to reliably automate it? Or should I not be commiting database changes often enough for it to matter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:24:31+00:00Added an answer on May 18, 2026 at 11:24 am

    Looking at your proposals, it doesn’t seem like something that’s feasible nor practical.
    I was working in a company where we used more than 1k tables per database (very complex system), and it all worked fine like this:

    • Have one person in charge of the DB (lets call him DBPerson) – every script/db change has to pass through him. This will avoid any unnecessary changes, and some ‘overlooks’ of the issues (for example, if someone moves an index to perform better for his query, hi might destroy other persons work, maybe someone will create a table that is completely redundant and unnecessary, etc…). This will keep db clean and efficient. Even if it seems like this is too much work for one guy (or his deputy), in fact it isn’t – the db usually rarely changes.
    • Each script has to pass validation through DBPerson
    • When the script is approved, the DBPerson assigns a number and puts it in ‘update’ folder/svn(…), with appropriate numbering (as you suggested, incremental numbers for example).
    • Next, if you have some continuous integration in place, the script gets picked up and updates the db (if you don’t have continuous integration, do it manually).
    • Do not store entire database script, with all the data in script. Store the actual database instead. If you have branches of the solution – have each branch with it’s own database, or you can always have update scripts divided for each of the branches so you could rollback/forward to another branch. But, I really recommend to have a separate db for each branch.
    • Have one database always with default data (intact) – for needs of unit tests, regression tests etc. Whenever you do the tests, do them on the copy of this database. You could even put a nightly cleanup of the test databases with the main one (if appropriate of course).

    In an environment like this you’ll have multiple versions of database:

    • Developers database (local) – the one that the dev guy is using to test his work. He can always copy from Master or Test Master.
    • Master database – the one with all the default values, maybe semi-empty if you’re doing redeploys to new clients.
    • Test Master database – Master database filled with test data. Any scripts you have ran on Master you ran here as well.
    • Test in progress database – copied from Test Master and used for testing – gets overwritten prior to any new test.
    • If you have branches (similar database with slight difference for each of the clients) than you’ll have the same as above for each branch…

    You will most certainly have to make modifications of this to match your situation, but anyway I think that keeping the textual version of the create script for entire database is wrong in terms of maintainability, merging, updating, etc…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Based on all my reading there should be one GC thread to invoke all
I have been doing a little reading on Flow Based Programming over the last
Apple strongly recommends using the binary plist format when reading large XML-based data sets
I'm trying to learn RegEx in Ruby, based on what I'm reading in The
Based on this question it appears that the default template for CheckStyle will allow
Based on a simple test I ran, I don't think it's possible to put
Based on a few posts I've read concerning version control, it seems people think
Based on their work, how do you distinguish a great SQL developer? Examples might
Based on the response to this question: Why does C++ have header files and
Based on my previous question here my new concern is how do I unit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.