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.
This commit is contained in:
Holger Hans Peter Freyther 2009-08-10 08:36:04 +02:00
parent 6d30a35d21
commit 850326e377
1 changed files with 6 additions and 6 deletions

View File

@ -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;
}