diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-12 01:54:21 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-12 01:54:21 +0200 |
| commit | bbdf38018b47328b5faa2cef635c37095045be72 (patch) | |
| tree | 8983817d547551ae12508a8ae8731b622d990af4 /crates/turtle/db | |
| parent | feat(server): Make user stuff stateless (diff) | |
| download | atuin-bbdf38018b47328b5faa2cef635c37095045be72.zip | |
feat(server): Really make users stateless (with tests)
This commit also remove another load of unneeded features.
Diffstat (limited to 'crates/turtle/db')
3 files changed, 18 insertions, 7 deletions
diff --git a/crates/turtle/db/server-pg-migrations/20230623070418_records.sql b/crates/turtle/db/server-pg-migrations/20230623070418_records.sql index 22437595..a3e5de2e 100644 --- a/crates/turtle/db/server-pg-migrations/20230623070418_records.sql +++ b/crates/turtle/db/server-pg-migrations/20230623070418_records.sql @@ -8,7 +8,7 @@ create table records ( version text not null, tag text not null, -- what is this? history, kv, whatever. Remember clients get a log per tag per host data text not null, -- store the actual history data, encrypted. I don't wanna know! - cek text not null, + cek text not null, user_id bigint not null, -- allow multiple users created_at timestamp not null default current_timestamp diff --git a/crates/turtle/db/server-pg-migrations/20240614104159_idx-cache.sql b/crates/turtle/db/server-pg-migrations/20240614104159_idx-cache.sql index 76425ed7..12bbbecc 100644 --- a/crates/turtle/db/server-pg-migrations/20240614104159_idx-cache.sql +++ b/crates/turtle/db/server-pg-migrations/20240614104159_idx-cache.sql @@ -1,8 +1,8 @@ -create table store_idx_cache( - id bigserial primary key, - user_id bigint, +CREATE TABLE store_idx_cache( + id BIGSERIAL PRIMARY KEY, + user_id UUID, - host uuid, - tag text, - idx bigint + host UUID, + tag TEXT, + idx BIGINT ); diff --git a/crates/turtle/db/server-pg-migrations/20260611222503_make_user-id_an_uuid.sql b/crates/turtle/db/server-pg-migrations/20260611222503_make_user-id_an_uuid.sql new file mode 100644 index 00000000..d31c23e2 --- /dev/null +++ b/crates/turtle/db/server-pg-migrations/20260611222503_make_user-id_an_uuid.sql @@ -0,0 +1,11 @@ +-- Add migration script here + +ALTER TABLE records +DROP COLUMN IF EXISTS user_id; +ALTER TABLE records +ADD COLUMN user_id UUID NOT NULL; + +ALTER TABLE store +DROP COLUMN IF EXISTS user_id; +ALTER TABLE store +ADD COLUMN user_id UUID NOT NULL; |
