-- Extract Chapters 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", "VolumeId", "CreatedTime", "LastUpdatedTime" FROM "Chapter" ORDER BY "VolumeId", "Id"; -- Option 2: Generate INSERT statements SELECT format( 'INSERT INTO "Chapters" ("Id", "VolumeId", "CreatedTime", "LastUpdatedTime") VALUES (%s, %s, %L, %L) ON CONFLICT ("Id") DO NOTHING;', "Id", "VolumeId", "CreatedTime", "LastUpdatedTime" ) FROM "Chapter" ORDER BY "VolumeId", "Id"; -- Option 3: Export to CSV (run from psql) -- \copy (SELECT "Id", "VolumeId", "CreatedTime", "LastUpdatedTime" FROM "Chapter" ORDER BY "VolumeId", "Id") TO '/tmp/chapters_export.csv' WITH CSV HEADER;