aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-09-10 14:08:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-09-10 14:08:52 +0200
commita2bd159c93aced832cae1927c32703d3306d1b03 (patch)
tree91ce9675d053e9b3b3279bfa20ace2b2b4bad6e1
parent1a4a5134f848404cb6ade9ae384704cea1c95742 (diff)
In SQLite always add column without default value as NULL
-rw-r--r--odb/relational/sqlite/schema.cxx14
1 files changed, 7 insertions, 7 deletions
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