Add not null fields on populated tables

Add not null fields on populated tables.
Hi
  If Data Modeler where used to generate aurelius entity, default values are not created, this is a big issue, mainly when "Not Null" columns where created on populated tables. Because: "...the new ID fields that have been added to the existing rows will all be NULL. In this special case, Firebird allows invalid data to be present in a column. It will even write the NULLs to a backup without complaining, but it will refuse to restore them, precisely because of the constraint violation. "
Source: https://www.firebirdsql.org/pdfmanual/html/nullguide-alter-pop-tables.html
 Big, Big Issue, now i can not restore data base any more...
 As a sugestion you should add this feature as soon as possible
 Thanks

TMS Aurelius doesn't have a "default value" feature. So TMS Data Modeler doesn't have anywhere to export that info to. In this case you can try to validated the database update first (http://www.tmssoftware.biz/business/aurelius/doc/web/schema_validation.html) and check if you have warnings regarding creation of non-null fields in existing table. It gives such information to you. Then you can decide what to do.

Hi, Wagner
I know that :), but it's a very nice feature to add.
thanks

yes, that would be very nice. Just started working with this and hit that issue quite quickly. Had to use the Nullable<T>, whereas a default value would be better in some cases.

Hi, Wagner
  Sorry to insist about this, but i upgrade FB2.5 to FB3, and a big issue appeared.
  On FB2.5 is possibel to create a NOT NULL field  on a existing table with data even if that field was NULL!!!. Now on FB3, this is not possibel.
  So, after Aurelius create Fields i have to execute ALTER TABLE to set default values(FDScript is a TFDScript).

  "FDScript.SQLScripts[0].SQL.Add(FormatFDScript('ALTER TABLE A1 ALTER NewFieldNotNull SET DEFAULT 0' ));"
  Very important to maintain compatibility with old API versions when insert/update records on new database,
  diferente api version use same database simultaneouly

  "FDScript.SQLScripts[0].SQL.Add(TDBSchemaUpdateUtils.FormatFDScript('UPDATE A1 SET NewFieldNotNull = 0 WHERE NewFieldNotNull IS NULL'));"
  to update existing records.

  This is not possible on FB3, i believe like other Databases.

  What is the big picture for Field Default Values?
 
  For now a just can't figure out how to solve this issue.

  Thanks
 

You should always create a new field in a table using a default value. I mean, when executing ALTER TABLE to create a new NOT NULL column, you should also set the default value thus the database will allow creating that field and fill the existing records with default value.

I'm surprised that Firebird 2.5 allows you to create a NOT NULL field in an existing table with rows without specifying a default value. That would lead to data inconsistency.
Hi
  I don't understand what you mean, on preview post "If Data Modeler where used to generate aurelius entity,......." How to create Not Null field with Data Modeler with default value?
 
  "when executing ALTER TABLE to create a new NOT NULL column, you should also set the default value..." yes agreem i even don't understand why it's not possibel with Aurelius+Data Modeler!!!!

thank you so much
 

Sorry, but I don't understand exactly what is your point?

Aurelius doesn't have a feature to define Default Value for a column, thus it can't generate DML statements that create a field with a default value yet.
Hi
  i use Aurelius+DataModeler to create the new databases or upgrade existing database. When a new database is created every thing is fine, not null field is created. When upgrade data base to newest version, not null fields on existing tables with data are not created.
  what are my opitons?

Thanks

Your current option is to manually execute an ALTER TABLE statement created by yourself, specifying the default value of the field.

please consider this functionality, is too important feature to be ignored, I am surprised that no one has this need(in fact there are other developers request for this). This is a very old sugestion, as you can read my post about that issue on dezember 2015, also post a request.

Many thanks, sorry to by so persistence