PHP Classes

similar project to this

Recommend this page to a friend!

      Trigves Arm  >  All threads  >  similar project to this  >  (Un) Subscribe thread alerts  
Subject:similar project to this
Summary:similar project to this
Author:Matthew Kemmerer
Date:2017-03-22 08:27:14

  1. similar project to this   Reply   Report abuse  
Picture of Matthew Kemmerer Matthew Kemmerer - 2017-03-22 08:27:14
Hello, I have a similar project to this which you might be interested in. I don't understand why there aren't more projects like this. It seems to be a common problem no one has tried to solve. It can be a scary thing to do, automating changes to the database schema, but my answer to that is to make backups, and detailed logs to troubleshoot if something does go wrong. I also prevent running the script from a website, only allow from shell

Here's my project, it's still a work in progress. It has a dependency on the phpUtils library in the same github account.

One thing I see that I do different than your script, I query for a list of all tables when it's needed, and cache the results. Same with lists of fields in tables, I query for it when needed and cache the results.

My code is far from perfect and clean, but it's open source and you're welcome to look it over.

One more tip, on line 171 this can be shortened with fewer calls:

if(count($dbArgs) == count($arrayArgs) || count($dbArgs) < count($arrayArgs)) {

can be changed to:

if(count($dbArgs) <= count($arrayArgs)) {