9
Views
1
Comments
Solved
Adding new columns in PROD

Hi all,

I have an enterprise environment and am using SQL Server DB. The application has been moved to PROD and it is on-live. As a change, we are adding few more columns to the tables. What are the points I need to consider before moving to PROD including adding default values to the new column and the old rows? Please advise.

Rank: #55
Solution

Hi Abira,


If you add new columns to a table with records, these records will take the default value of that data type (false for booleans, 0 for numbers, '' (empty) for text and 1900-01-01 for dates).

What is usually done if you need to "fix" these columns, is to have a timer that updates these columns depending on your business case, properly tested in previous environments. The new records will take the new logic of the code and they will be ok. This timer is then of course removed on Development environment once it ran successfully on the code so you keep your code "clean".


Regards,

João