fix: sync database queries with enhanced media-items schema
- Add missing enhanced fields to CreateMediaItem INSERT statement - Add missing enhanced fields to UpdateMediaItem UPDATE statement - Include language, edition, page_count, genre, copyright_year - Include integration fields: goodreads_id, openlibrary_id, google_books_id - Add corresponding indexes for enhanced fields - Add column comments for better documentation - Resolves schema-query mismatch causing field removal cycles
This commit is contained in:
@@ -102,8 +102,8 @@ ORDER BY l.created_at DESC;
|
||||
|
||||
-- Media Items queries
|
||||
-- name: CreateMediaItem :one
|
||||
INSERT INTO media_items (library_id, title, author, isbn, description, file_path, file_size, mime_type, cover_image_path, series, series_number, tags, asin, date_published, publisher, contributors, added_by_admin_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
|
||||
INSERT INTO media_items (library_id, title, author, isbn, description, file_path, file_size, mime_type, cover_image_path, series, series_number, tags, asin, date_published, publisher, contributors, language, edition, page_count, genre, copyright_year, goodreads_id, openlibrary_id, google_books_id, added_by_admin_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetMediaItem :one
|
||||
@@ -256,6 +256,14 @@ UPDATE media_items SET
|
||||
date_published = $11,
|
||||
publisher = $12,
|
||||
contributors = $13,
|
||||
language = $14,
|
||||
edition = $15,
|
||||
page_count = $16,
|
||||
genre = $17,
|
||||
copyright_year = $18,
|
||||
goodreads_id = $19,
|
||||
openlibrary_id = $20,
|
||||
google_books_id = $21,
|
||||
updated_at = NOW()
|
||||
WHERE id = $1
|
||||
RETURNING *;
|
||||
|
||||
Reference in New Issue
Block a user