Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

If I have an existing table in a NoSQL database cluster and I want to add a new column that should never return null, how do I handle it in my application code?

  • I can update all exist records and set that new column to some default value (if there is a sensible default).
  • I can have my application code assume a default value if it reads a records with no value for the field
  • ???

The problem I see with the first solution is that there may be existing code that writes records without the mandatory column leaving the table with "broken" records. The second solution may "mask" existing code that fails to write the new column value.

How do people handle this scenario?

share|improve this question
    
How about populating existing records, and then running a daily exception report for data without the new value? It should help you pin down any apps which are creating records. –  Jon of All Trades Nov 22 '13 at 22:59
    
Something like that may work. Thanks. –  Ralph Nov 22 '13 at 23:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.