aboutsummaryrefslogtreecommitdiff
path: root/evolution/alter-column/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-04-05 12:27:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-04-10 18:46:46 +0200
commit0429c7b008594a874696f91c29b17ae4ee40efff (patch)
treec98c34dc43e32f4fa2589daea0acc9e2e83d3227 /evolution/alter-column/driver.cxx
parentf0a8672c2128041001d6badba42ff672126581bb (diff)
Add NOT NULL column without default value initially as NULL
Diffstat (limited to 'evolution/alter-column/driver.cxx')
-rw-r--r--evolution/alter-column/driver.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/evolution/alter-column/driver.cxx b/evolution/alter-column/driver.cxx
index 28e6e7c..193289f 100644
--- a/evolution/alter-column/driver.cxx
+++ b/evolution/alter-column/driver.cxx
@@ -63,11 +63,13 @@ main (int argc, char* argv[])
assert (!p->str);
assert (p->num && *p->num == 123);
+ assert (!p->num1);
// Migration.
//
p->str = "abc";
p->num.reset ();
+ p->num1 = 123;
db->update (*p);
t.commit ();
@@ -93,12 +95,25 @@ main (int argc, char* argv[])
try
{
object o2 (2);
+ o2.num1 = 234; // str is NULL
transaction t (db->begin ());
db->persist (o2);
assert (false);
}
catch (const odb::exception& ) {}
+
+ try
+ {
+ object o3 (3);
+ o3.str = "bcd"; // num1 is NULL
+
+ transaction t (db->begin ());
+ db->persist (o3);
+ assert (false);
+ }
+ catch (const odb::exception& ) {}
+
break;
}
default: