aboutsummaryrefslogtreecommitdiff
path: root/qlite
diff options
context:
space:
mode:
authorSamuel Hand <samuel.hand@openmailbox.org>2018-06-19 11:26:31 +0100
committerSamuel Hand <samuel.hand@openmailbox.org>2018-06-19 11:26:31 +0100
commit2a8352c5439129798b5141ec021b3b9405840a8a (patch)
treefcacb76529c0b7535b89a496092aac126cefdbc9 /qlite
parent0bcdae34a5dbe5a102281e1b1bc405f5977dc659 (diff)
downloaddino-2a8352c5439129798b5141ec021b3b9405840a8a.tar.gz
dino-2a8352c5439129798b5141ec021b3b9405840a8a.zip
Database migration and code cleanup
Diffstat (limited to 'qlite')
-rw-r--r--qlite/src/table.vala4
1 files changed, 3 insertions, 1 deletions
diff --git a/qlite/src/table.vala b/qlite/src/table.vala
index 00b4ef00..7fa2fc62 100644
--- a/qlite/src/table.vala
+++ b/qlite/src/table.vala
@@ -95,10 +95,12 @@ public class Table {
public void create_table_at_version(long version) {
ensure_init();
string sql = @"CREATE TABLE IF NOT EXISTS $name (";
+ bool first = true;
for (int i = 0; i < columns.length; i++) {
Column c = columns[i];
if (c.min_version <= version && c.max_version >= version) {
- sql += @"$(i > 0 ? "," : "") $c";
+ sql += @"$(!first ? "," : "") $c";
+ first = false;
}
}
sql += @"$constraints)";