fix: sql table setup

This commit is contained in:
Ludo Galabru
2023-06-30 14:49:14 -04:00
parent d0c7b597e6
commit c8884a7dbe

View File

@@ -77,7 +77,7 @@ pub fn initialize_hord_db(path: &PathBuf, ctx: &Context) -> Connection {
} else {
if let Err(e) = conn.execute(
"CREATE TABLE IF NOT EXISTS locations (
inscription_id TEXT NOT NULL PRIMARY KEY,
inscription_id TEXT NOT NULL,
block_height INTEGER NOT NULL,
tx_index INTEGER NOT NULL,
outpoint_to_watch TEXT NOT NULL,
@@ -108,6 +108,7 @@ pub fn initialize_hord_db(path: &PathBuf, ctx: &Context) -> Connection {
) {
ctx.try_log(|logger| slog::warn!(logger, "{}", e.to_string()));
}
if let Err(e) = conn.execute(
"CREATE INDEX IF NOT EXISTS index_inscriptions_on_block_height ON inscriptions(block_height);",
[],
@@ -126,6 +127,12 @@ pub fn initialize_hord_db(path: &PathBuf, ctx: &Context) -> Connection {
) {
ctx.try_log(|logger| slog::warn!(logger, "{}", e.to_string()));
}
if let Err(e) = conn.execute(
"CREATE INDEX IF NOT EXISTS index_locations_on_inscription_id ON locations(inscription_id);",
[],
) {
ctx.try_log(|logger| slog::warn!(logger, "{}", e.to_string()));
}
}
conn
}