aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/db.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-08-10 08:36:04 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-08-10 08:36:04 +0200
commit850326e377f59211dfc03ab1d4623a896b987143 (patch)
treee836a2ddef56ae7318e0a4a7a78c140a5fcd2037 /openbsc/src/db.c
parent6d30a35d2185e05fcade63182240d96c7f7d4a89 (diff)
db.c: Move the schema revision check after creating the tables
When starting the first time there are no tables, doing a revision check will fail and bsc_hack will exit without tables created. Do the revision check within db_prepare and allow new tables to be created before.
Diffstat (limited to 'openbsc/src/db.c')
-rw-r--r--openbsc/src/db.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/openbsc/src/db.c b/openbsc/src/db.c
index 90bee6925..9ad39d3da 100644
--- a/openbsc/src/db.c
+++ b/openbsc/src/db.c
@@ -161,12 +161,6 @@ int db_init(const char *name) {
if (dbi_conn_connect(conn) < 0)
goto out_err;
- if (check_db_revision() < 0) {
- fprintf(stderr, "Database schema revision invalid, "
- "please update your database schema\n");
- goto out_err;
- }
-
return 0;
out_err:
@@ -190,6 +184,12 @@ int db_prepare() {
dbi_result_free(result);
}
+ if (check_db_revision() < 0) {
+ fprintf(stderr, "Database schema revision invalid, "
+ "please update your database schema\n");
+ return -1;
+ }
+
return 0;
}