From a1433e0cefe3ad001d5473faf4312c25bdeea968 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Tue, 6 May 2025 08:36:32 -0700 Subject: feat: Implement KV as a write-through cache (#2732) --- .../atuin-kv/migrations/20250501160746_create_kv_db.down.sql | 2 ++ .../atuin-kv/migrations/20250501160746_create_kv_db.up.sql | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 crates/atuin-kv/migrations/20250501160746_create_kv_db.down.sql create mode 100644 crates/atuin-kv/migrations/20250501160746_create_kv_db.up.sql (limited to 'crates/atuin-kv/migrations') diff --git a/crates/atuin-kv/migrations/20250501160746_create_kv_db.down.sql b/crates/atuin-kv/migrations/20250501160746_create_kv_db.down.sql new file mode 100644 index 00000000..bce8dfd3 --- /dev/null +++ b/crates/atuin-kv/migrations/20250501160746_create_kv_db.down.sql @@ -0,0 +1,2 @@ +-- Add down migration script here +DROP TABLE kv; diff --git a/crates/atuin-kv/migrations/20250501160746_create_kv_db.up.sql b/crates/atuin-kv/migrations/20250501160746_create_kv_db.up.sql new file mode 100644 index 00000000..77384044 --- /dev/null +++ b/crates/atuin-kv/migrations/20250501160746_create_kv_db.up.sql @@ -0,0 +1,12 @@ +-- Add up migration script here +CREATE TABLE + kv ( + namespace TEXT NOT NULL, + key TEXT NOT NULL, + value TEXT NOT NULL, + inserted_at INTEGER NOT NULL DEFAULT (strftime ('%s', 'now')) + ); + +CREATE INDEX idx_kv_namespace ON kv (namespace); + +CREATE UNIQUE INDEX idx_kv ON kv (namespace, key); -- cgit v1.3.1