Delete test data in ensureTableExists()
This commit is contained in:
parent
e5c92174f4
commit
f81ef8249c
|
|
@ -26,27 +26,6 @@ void Database::ensureTableExists() {
|
||||||
")"
|
")"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Проверяем, есть ли данные
|
|
||||||
auto result = txn.exec("SELECT COUNT(*) FROM random_data");
|
|
||||||
int count = result[0][0].as<int>();
|
|
||||||
|
|
||||||
// Если данных нет, заполняем тестовыми данными
|
|
||||||
if (count == 0) {
|
|
||||||
txn.exec(
|
|
||||||
"INSERT INTO random_data (name, value, description) VALUES "
|
|
||||||
"('Alpha', 100, 'First test record'), "
|
|
||||||
"('Beta', 200, 'Second test record'), "
|
|
||||||
"('Gamma', 300, 'Third test record'), "
|
|
||||||
"('Delta', 400, 'Fourth test record'), "
|
|
||||||
"('Epsilon', 500, 'Fifth test record'), "
|
|
||||||
"('Zeta', 600, 'Sixth test record'), "
|
|
||||||
"('Eta', 700, 'Seventh test record'), "
|
|
||||||
"('Theta', 800, 'Eighth test record'), "
|
|
||||||
"('Iota', 900, 'Ninth test record'), "
|
|
||||||
"('Kappa', 1000, 'Tenth test record')"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue