sonda/migrations/postgres/0030_spotify_imports.sql
tgiachi aa4883b955 feat(import): an Import page, with the numbers of every import kept
The report of an import used to be shown once in Settings and lost. Each
import is now stored (migration 0030, spotify_imports) as the report in
JSON, and GET /me/import/spotify lists the past ones, newest first.
POST /me/import/spotify answers with the same shape plus id and created_at.

The web app gets an Import page (menu, More tab) with the form and one card
for each past import: plays read, added, already there, not in the library,
the playlists it made and the artists that are missing. Settings only links
to it. An import that finds nothing is not kept, and a report that cannot be
stored is still returned to the person who asked.
2026-11-15 10:34:12 +01:00

10 lines
380 B
SQL

-- PostgreSQL flavour of sqlite/0030_spotify_imports.sql.
CREATE TABLE spotify_imports (
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
created_at BIGINT NOT NULL,
report TEXT NOT NULL
);
CREATE INDEX idx_spotify_imports_user ON spotify_imports(user_id, created_at DESC);