This commit is contained in:
2026-10-11 02:23:22 +07:00
parent 9d46fc0e13
commit 62b623d3ca
9 changed files with 1089 additions and 716 deletions
@@ -0,0 +1,22 @@
-- +goose Up
CREATE TABLE game_imports (
id TEXT PRIMARY KEY,
package_id TEXT NOT NULL,
source_server TEXT NOT NULL,
source_game_id INTEGER NOT NULL,
sha256 TEXT NOT NULL,
initiator_id INTEGER REFERENCES users(id) ON DELETE SET NULL,
manifest JSONB NOT NULL,
original_data JSONB NOT NULL,
mappings JSONB NOT NULL DEFAULT '{}'::jsonb,
object_keys TEXT[] NOT NULL,
state TEXT NOT NULL DEFAULT 'preparing' CHECK (state IN ('preparing', 'ready', 'failed')),
created_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
lease_until TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() + INTERVAL '2 minutes',
cleaned_at TIMESTAMPTZ
);
CREATE UNIQUE INDEX game_imports_active_package ON game_imports(package_id) WHERE state IN ('preparing', 'ready');
CREATE UNIQUE INDEX game_imports_active_game ON game_imports(source_game_id) WHERE state IN ('preparing', 'ready');
-- +goose Down
DROP TABLE game_imports;