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 4079782
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:50:45+00:00 2026-05-20T17:50:45+00:00

I am a PHP software developer and am looking for the best solution to

  • 0

I am a PHP software developer and am looking for the best solution to get around this concern I have. I am create a script that will in the future have new releases that includes new features, bugfixes, etc. I know how to do the code changes in the upgrade script, however I the script I am developing uses MySQL to store data in multiple tables.

Now here is the question, I have figured out how to make an install script for the initial release, however what is the best solution/method to making an upgrade script that can upgrade any previous version up to the latest version? The latest version has new MySQL tables (not a problem), however it also changes the database structure (new columns, delete columns, etc.) I will create a scenario below to better picture what I am worried about.

v0.1.0 – Initial Release

v0.1.1 – Has a new database table and some fields added to the table structure

v0.2.0 – Has more new fields added to different tables

My concern is the the upgrade v0.1.0 > v0.2.0 because there were changes between the two versions.

UPDATE I probably could have mentioned that I am using GitHub as my VCS for the code alone. All code changes are saved there and in the install or upgrade script for code changes, I just plan on overwriting the user’s current files as they shouldn’t have any data within class/function files.

  • 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-20T17:50:46+00:00Added an answer on May 20, 2026 at 5:50 pm

    In my experience, the best approach is to create a versioning table in MySQL that includes the application’s version number along with any queries that change the structure of the database. So essentially:

    CREATE TABLE versions (
        app_version DOUBLE NOT NULL,
        query TEXT,
        created TIMESTAMP NOT NULL 
    );
    

    With our install script, we take note of our initial application version and our destination application version and select all queries that need to be executed for this to work.

    SELECT query FROM versions WHERE app_version > {$initialAppVersion} AND app_version <= {$destinationAppVersion} ORDER BY created ASC;
    

    In PHP:

    foreach ($resultset AS $row) {
        $stmt = $db->prepare($row['query']);
        try {
           $stmt->execute();
        } catch (Exception $e) { /* handle exception */ }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP (among others) will execute the deepest function first, working its way out. For
PHP, for all its warts, is pretty good on this count. There's no difference
This question is geared towards a group of newly hired developers that need to
I've been a software developer for over twenty years, programming in C, Perl, SQL,
as web developer using PHP/JS/CSS for years , i suffer from repeat myself over
I am thinking of selling a piece of PHP software (set of scripts). Naturally,
I'm writing note software in PHP (to store notes) and most often I include
I'm looking for a free (FOSS) speech recognition engine that I can use with
PHP has a great function called htmlspecialcharacters() where you pass it a string and
PHP's explode function returns an array of strings split on some provided substring. It

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.