Repository navigation
feat(payload): add content collections with sheet import and comparison - #46
Merged
maxitect merged 12 commits intoNov 12, 2026
Merged
Conversation
…initial migration
✅ Deploy Preview for clarksbowlingclub ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
maxitect
marked this pull request as ready for review
November 12, 2026 23:11
maxitect
deleted the
feat/33-replace-the-google-sheet-with-payload-for-site
branch
November 12, 2026 23:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Payload with the collections, import and comparison scripts the sheet replacement needs, and makes the cached data functions read from Payload when
DATABASE_URLis set. Production has noDATABASE_URL, so it keeps reading the sheet and nothing visitors see changes until the switchover.Changes
users,media(images only, localised alt),en/frlocalisation, GraphQL off, S3 storage mapped in one file (src/lib/payload/storage.ts,S3_*names only), admin and REST routes undersrc/app/(payload)/. Advent calendar live at /calendrier by 1 December #29 adds collections tosrc/payload.config.tswithout touching the rest.tour-dates,music-items,lyrics(explicit order; lyricsstatusdraft/published, public reads published only) and globalsabout-page,tour-page. Rules the sheet never had: tour date needs date and venue, links must behttps:, a musicsrcmust be on the host of its type (YouTube, Spotify, Bandcamp), publishing a song needs lyrics.src/lib/data/content.tskeeps the same cached functions and shapes, so pages and components are untouched. It pickspayload.tswhenDATABASE_URLis set andsheet.tsotherwise. Saving or deleting in the admin expires the cache tag straight away.pnpm content:import(idempotent: upserts on date and venue /src/ title and album, trims values, keeps sheet order, songs without lyrics become drafts) andpnpm content:compare(reads both sources, reports any difference, exit 1 if any).netlify.toml:payload migrateruns before the build only whenDATABASE_URLis set, so production is unaffected until the switchover.docs/admin-guide.mdfor the band;docs/tickets/INSTRUCTIONS.mddescribes the two content sources.Acceptance criteria
previewanddev)/about,/tour,/music,/lyricslook the same, both languages, same order/sitemap.xml,/llms.txt,.mdpages list the same content/tourwithin a minute, no redeployhttps:ticket link, cannot be saved/adminor read drafts through the APICloses
Closes #33
Notes
Closesline is required by the PR script; reopen the issue or track steps 2 to 6 below. This PR is switchover step 1 plus the code for step 4.previewanddevwere reset to their parent, migrated and imported;content:compareprints "No difference." on both. The deploy preview builds and serves the imported content.content:importandcontent:comparerun withNODE_ENV=production, so they never push the schema in dev mode; a dev push leaves a marker that makes the nextpayload migratestop at an interactive prompt.DATABASE_URLis unset,next.config.tsrewrites/admin/*and/api/*(except/api/send-emails) to a 404, as before Payload.previewbucket; a first image upload on the preview admin settles it.database.mdregister: no departures.lyrics.statusis a plainselect, notversions.drafts, so required columns stayNOT NULL. Thelyricsandtour-datesPayload_ordercolumns come fromorderable: true..mdpages, which list in sheet order, stay identical. The/tourpage still sorts by date./adminlogs a dev-only Next warning about runtime data ingenerateMetadata()(Payload's template page). The page renders and the production build passes./tour?isFrench=trueis the existing client-side language switch, unrelated./adminbelong to Security hardening: headers, CMS URLs, email and account settings #34;robots.tsdoes not disallow/adminyet.AGENTS.mdis the noticenext devwrites; committed to keep the tree clean.Post-merge steps (production, not done here)
DATABASE_URL(Neonmain, pooled),PAYLOAD_SECRET,S3_ENDPOINT,S3_REGION,S3_BUCKET,S3_ACCESS_KEY_ID,S3_SECRET_ACCESS_KEY. SettingDATABASE_URLis what flips the site to Payload at the next deploy, so holdDATABASE_URLback until step 4 and set the others first. The build runspayload migrateonceDATABASE_URLexists; or run it by hand againstmainbefore (step 1)./admin(first visit creates the first user); sharedocs/admin-guide.md.mainenv loaded andSHEET_CSV_URL, runpnpm content:import, thenpnpm content:compareuntil it prints "No difference."DATABASE_URLon production and deploy. Watch the Netlify logs through the deploy. Roll back in Netlify if anything is wrong.src/lib/data/sheet.ts,src/utils/fetchSheet.ts,parseCsv.ts,parsePageCsv.ts, the import and compare scripts andSHEET_CSV_URL, then unpublish the sheet.Review
Verdict: ALL CLEAR
Rounds: 2
payload migratehung on an interactive promptfrlocale (French lyrics required to publish)fallbackLocale: false, againstdatabase.md; French category came outundefined/adminand/api/*answered 200 with an error screen and 500 instead of 404previewpreviewreset, migrated and imported; preview greengetMusicItemsandgetLyricspair theenandfrqueries by index_order; left as isRe-verified: AC1 (cli, db) PASS · AC2 (browser, 0 px on 16 local shots; preview vs production differs only by the Netlify drawer) PASS · AC6 (cli) PASS · AC7 (deploy: signed-out
/api/lyrics?where[status][equals]=drafttotalDocs 0,/api/lyrics15 published,/adminshows the login) PASS · AC9 (cli: no-env build,/admin/api/users/api/lyrics404,/api/send-emailsGET 405 as on production; withDATABASE_URL,/admin/login200,/api/users403) PASS · check.sh PASSEvidence
AC1
Negative: after adding a tour date and a music item, the same command printed
DIFF tour dates,DIFF music items,2 differ.and exited 1. The migration contains nojsonborgeometrycolumn and no_rels,_textsor_numberstable for our collections (grep over the generated SQL: onlypayload_*tables).AC2
AC3
AC5
AC6
AC7
AC9
AC9, guard (round 1 fix)