Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to minimize application downtime when updating database and application ORM

Tags:

database

orm

We currently run an ecommerce solution for a leisure and travel company. Everytime we have a release, we must bring the ecommerce site down as we update database schema and the data access code. We are using a custom built ORM where each data entity is responsible for their own CRUD operations. This is accomplished by dynamically generating the SQL based on attributes in the data entity.

For example, the data entity for an address would be...

[tableName="address"]
public class address : dataEntity
{
  [column="address1"]
  public string address1;
  [column="city"]
  public string city;
}

So, if we add a new column to the database, we must update the schema of the database and also update the data entity.

As you can expect, the business people are not too happy about this outage as it puts a crimp in their cash-flow. The operations people are not happy as they have to deal with a high-pressure time when database and applications are upgraded. The programmers are upset as they are constantly getting in trouble for the legacy system that they inherited.

Do any of you smart people out there have some suggestions?

like image 436
yamspog Avatar asked Nov 05 '22 13:11

yamspog


1 Answers

The first answer is obviously, don't use an ORM. Only application programmers think they're good. Learn SQL like everyone else :)

OK, so back to reality. What's to stop you restricting all schema changes to be additions only. Then you can update the DB schema anytime you like, and only install the recompiled application until a safe time (6am works best I find) after the DB is updated. If you must remove things, perform the steps the other way round - install the new app leaving the schema unchanged, and then remove the bits from the schema.

You're always going to have a high-pressure time as you roll out changes, but at least you can manage it better by doing it in 2 easier to understand pieces. Your DBAs will be ok with updating the schema for the existing application.

The downside is that you have to be a lot more organised, but that's not a bad thing when dealing with production servers and you should be seriously organised about it currently.

like image 55
gbjbaanb Avatar answered Nov 15 '22 10:11

gbjbaanb