Skip to content

Commit c8884a7

Browse files
author
Ludo Galabru
committed
fix: sql table setup
1 parent d0c7b59 commit c8884a7

File tree

1 file changed

+8
-1
lines changed
  • components/chainhook-sdk/src/hord/db

1 file changed

+8
-1
lines changed

components/chainhook-sdk/src/hord/db/mod.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn initialize_hord_db(path: &PathBuf, ctx: &Context) -> Connection {
7777
} else {
7878
if let Err(e) = conn.execute(
7979
"CREATE TABLE IF NOT EXISTS locations (
80-
inscription_id TEXT NOT NULL PRIMARY KEY,
80+
inscription_id TEXT NOT NULL,
8181
block_height INTEGER NOT NULL,
8282
tx_index INTEGER NOT NULL,
8383
outpoint_to_watch TEXT NOT NULL,
@@ -108,6 +108,7 @@ pub fn initialize_hord_db(path: &PathBuf, ctx: &Context) -> Connection {
108108
) {
109109
ctx.try_log(|logger| slog::warn!(logger, "{}", e.to_string()));
110110
}
111+
111112
if let Err(e) = conn.execute(
112113
"CREATE INDEX IF NOT EXISTS index_inscriptions_on_block_height ON inscriptions(block_height);",
113114
[],
@@ -126,6 +127,12 @@ pub fn initialize_hord_db(path: &PathBuf, ctx: &Context) -> Connection {
126127
) {
127128
ctx.try_log(|logger| slog::warn!(logger, "{}", e.to_string()));
128129
}
130+
if let Err(e) = conn.execute(
131+
"CREATE INDEX IF NOT EXISTS index_locations_on_inscription_id ON locations(inscription_id);",
132+
[],
133+
) {
134+
ctx.try_log(|logger| slog::warn!(logger, "{}", e.to_string()));
135+
}
129136
}
130137
conn
131138
}

0 commit comments

Comments
 (0)