From a2bd159c93aced832cae1927c32703d3306d1b03 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 10 Sep 2013 14:08:52 +0200 Subject: In SQLite always add column without default value as NULL --- odb/relational/sqlite/schema.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'odb/relational') diff --git a/odb/relational/sqlite/schema.cxx b/odb/relational/sqlite/schema.cxx index 46ce762..c4d852d 100644 --- a/odb/relational/sqlite/schema.cxx +++ b/odb/relational/sqlite/schema.cxx @@ -60,13 +60,7 @@ namespace relational struct create_column: relational::create_column, context { - create_column (base const& x): base (x) - { - // In SQLite it is impossible to alter a column later, so we add - // it as is. - // - override_null_ = false; - } + create_column (base const& x): base (x) {} virtual void traverse (sema_rel::add_column& ac) @@ -81,6 +75,12 @@ namespace relational os << "ALTER TABLE " << quote_id (at.name ()) << endl << " ADD COLUMN "; + + // In SQLite it is impossible to alter a column later, so unless + // it has a default value, we add it as NULL. Without this, it + // will be impossible to add a column to a table that contains + // some rows. + // create (ac); // SQLite doesn't support adding foreign keys other than inline -- cgit v1.1