Repository navigation
feat: add migrate:desk_assets task - #107
Merged
Merged
Conversation
Migrates level zone desk metadata into assets, remaps desk bookings to the new asset ids and enables desk.use_assets in org settings, in a single transaction. Re-runnable, with an opt-in dry_run. Adds a spec suite. Closes #106 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 tasks done
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.
Closes #106
Adds
task migrate:desk_assets [dry_run=true]. It moves desks fromdesksmetadata on level zones into theassettable, all in one transaction.config.org_zone→ walk the zone tree → for eachlevel, its branch (org, region if any, building, level) and itsdesksmetadata_DESKS_category and typezone_id,map_id), following the field map in the issueasset_id/asset_idson desk bookings, plus asset overrides onbooking_instances. When a desk id exists on several levels,booking.zonesdecides which one{"desk": {"use_assets": true}}into each org zone'ssettingsRe-runs update existing assets in place, and bookings that already point at a desk asset are counted as "already migrated".
dry_run=trueprints the summary and then rolls back.init had no specs, so this adds
./test, a docker compose file, a models migrator (copied from rest-api) and a CI test job.Review
./test: 6 examples, 0 failuresDatabase.connection { db.exec(..., args: [...]) }rather thanexec_sql.exec_sqlopens a new connection outside the transaction, and the splat form crashed the Crystal compiler in the spec buildAsset#nameisn't in the mapping, so it stays nil🤖 Generated with Claude Code