mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-06-15 00:49:30 +08:00
fix: sql table setup
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user