fix(EventsDb): avoid duplication in db

This commit is contained in:
Ronan Abhamon 2017-09-06 17:05:46 +02:00
parent b83fe6411a
commit 648119fd4b
3 changed files with 5 additions and 5 deletions

View file

@ -135,13 +135,13 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
*session <<
"CREATE TABLE IF NOT EXISTS sip_address ("
" id" + primaryKeyAutoIncrementStr() + ","
" value VARCHAR(255) NOT NULL"
" value VARCHAR(255) UNIQUE NOT NULL"
")";
*session <<
"CREATE TABLE IF NOT EXISTS event_type ("
" id TINYINT UNSIGNED,"
" value VARCHAR(255) NOT NULL"
" value VARCHAR(255) UNIQUE NOT NULL"
")";
*session <<
@ -157,13 +157,13 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
*session <<
"CREATE TABLE IF NOT EXISTS message_state ("
" id TINYINT UNSIGNED,"
" value VARCHAR(255) NOT NULL"
" value VARCHAR(255) UNIQUE NOT NULL"
")";
*session <<
"CREATE TABLE IF NOT EXISTS message_direction ("
" id TINYINT UNSIGNED,"
" value VARCHAR(255) NOT NULL"
" value VARCHAR(255) UNIQUE NOT NULL"
")";
*session <<

Binary file not shown.

View file

@ -37,7 +37,7 @@ static const string getDatabasePath () {
static void open_database () {
EventsDb eventsDb;
eventsDb.connect(EventsDb::Sqlite3, getDatabasePath());
BC_ASSERT_TRUE(eventsDb.connect(EventsDb::Sqlite3, getDatabasePath()));
}
test_t events_db_tests[] = {