-- Extract Volumes from NovelService database
-- Run this against: NovelService PostgreSQL database
-- Output: CSV or use COPY TO for bulk export

-- Option 1: Simple SELECT for review/testing
SELECT
    "Id",
    "NovelId",
    "CreatedTime",
    "LastUpdatedTime"
FROM "Volume"
ORDER BY "NovelId", "Id";

-- Option 2: Generate INSERT statements
SELECT format(
    'INSERT INTO "Volumes" ("Id", "NovelId", "CreatedTime", "LastUpdatedTime") VALUES (%s, %s, %L, %L) ON CONFLICT ("Id") DO NOTHING;',
    "Id",
    "NovelId",
    "CreatedTime",
    "LastUpdatedTime"
)
FROM "Volume"
ORDER BY "NovelId", "Id";

-- Option 3: Export to CSV (run from psql)
-- \copy (SELECT "Id", "NovelId", "CreatedTime", "LastUpdatedTime" FROM "Volume" ORDER BY "NovelId", "Id") TO '/tmp/volumes_export.csv' WITH CSV HEADER;
