When executing UpdateDatabase in TdatabaseManager I am getting the following error:
'Error: Cannot add a NOT NULL column with default value NULL'
Sql query:
'ALTER TABLE pat
ADD relat TEXT NOT NULL'
Is this the "missing feature to set column's default value" ?
Thank you in advance
I am not sure because today, I delete the table and it was recreated by Aurelius without problem.
At the same time, if I run the above sql query from SQL Expert, it runs without errors and the table is altered.
Am I missing something?
My call stack:
:7714a6e2 KERNELBASE.RaiseException + 0x62
Aurelius.Drivers.SQLite.Classes.TSqliteDatabase.RaiseError('ALTER TABLE pat'#$D#$A' ADD relat TEXT NOT NULL')
Aurelius.Drivers.SQLite.Classes.TSqliteStatement.Create($8BED380,'ALTER TABLE pat'#$D#$A' ADD relat TEXT NOT NULL')
Aurelius.Drivers.SQLite.Classes.TSqliteDatabase.Prepare('ALTER TABLE pat'#$D#$A' ADD relat TEXT NOT NULL')
Aurelius.Drivers.SQLite.TSQLiteNativeStatementAdapter.PrepareStatement
Aurelius.Drivers.SQLite.TSQLiteNativeStatementAdapter.Execute
Aurelius.Commands.AbstractSqlPerformer.TAbstractSQLPerformer.Execute('ALTER TABLE pat'#$D#$A' ADD relat TEXT NOT NULL',nil,1)
Aurelius.Commands.AbstractCommandPerformer.TSQLPerformer.Execute('ALTER TABLE pat'#$D#$A' ADD relat TEXT NOT NULL',nil,1)
Aurelius.Commands.AbstractCommandPerformer.TSQLPerformer.ExecuteSQL('ALTER TABLE pat'#$D#$A' ADD relat TEXT NOT NULL')
Aurelius.Engine.DatabaseManager.TDatabaseManager.ExecuteSQLStatements($8FE68D0,False)
Aurelius.Engine.DatabaseManager.TDatabaseManager.UpdateDatabase
procedure dbinit;
begin
dbc:=TSQLiteConnection.Create('Database='+tpath.Combine(dirint,'sb.db')+';EnableForeignKeys=True');
dbmap:=TMappingExplorer.Default;
with TDatabaseManager.Create(dbc,dbmap) do
try
UpdateDatabase;
finally
Free;
end;
end;
Why the same ALTER sql command runs from SQL Expert but gives error when it runs during databaseUpdate?
How can the table be created by aurelius but not altered?