|
@@ -122,18 +122,19 @@ impl DB {
|
|
|
"SELECT * FROM \"sqlite_master\" WHERE \"type\"='table' AND \"name\"='{}'",
|
|
|
Metaschema::table_name()
|
|
|
),
|
|
|
- |row| {
|
|
|
- println!("row: {:?}", row);
|
|
|
+ |_row| {
|
|
|
has_metaschema = true;
|
|
|
true
|
|
|
},
|
|
|
)
|
|
|
.map_err(DBError::EarlyFailure)?;
|
|
|
|
|
|
- if mode != CreateMode::MustExist {
|
|
|
- println!("Creating schema!");
|
|
|
+ if !has_metaschema && mode != CreateMode::MustExist {
|
|
|
return self.create_schema();
|
|
|
}
|
|
|
+ else if !has_metaschema && mode == CreateMode::MustExist {
|
|
|
+ return Err(DBError::NoSchema)
|
|
|
+ }
|
|
|
|
|
|
let qi = query::QueryInterface::new(self);
|
|
|
let hash = qi.get_one_by(meta::MetaschemaColumns::Key, "schema_hash");
|