1

There are multiple, ever-increasing number of sites that run off a single instance of a CMS (built in CakePHP) on a single server array. The CMS has a set database structure, but will likely need updating fairly regularly - new fields, changing names of fields, new tables ...etc.

I can't wrap my head around a good way to 1) keep the sites having their own databases (seemingly ideal), but two, always basing them off the same, regularly-updated database structure.

So far I thought to keep a single "template" database, and only update that, then write a script to compare and update - but even then, how would I know if a field changed, or if it was a new field, and previous field deleted...etc etc etc. I'm sure I haven't even thought of all the problems this will cause. Any advice greatly appreciated.

Dave
  • 28,833
  • 23
  • 113
  • 183

1 Answers1

1

You could use a migrations tool like https://github.com/CakeDC/migrations. The basic idea behind migrations is to have a kind of version control for your database schema, with each migration representing a "commit" describing the changes (like add table, rename field, etc.) that should be applied to the database schema.

dhofstet
  • 9,934
  • 1
  • 36
  • 37
  • That sounds like exactly what I was looking for, thanks! Going to leave the question open for a day or so in case there are other ideas, but this is likely the answer, thanks! – Dave Mar 24 '13 at 16:56