Repository navigation
feat: buildingsの主キーをDB内部専用にし、building_no/keyを新設 - #4
Merged
Merged
Conversation
buildings.csvのid(1,3,4,5...と欠番あり)がbuildings.idとして 主キーに使われていたが、本来これは安定したPKではなく外部公開用の 識別子だった。buildings.idをDB内部専用のSERIAL主キーとし、 旧idはbuilding_no(UNIQUE)として分離。nodes/rooms/photos.building_id やAPIのbuilding_idは引き続きbuilding_noを参照するため、既存の 挙動・API契約は変わらない。 あわせてdb/seeds/memo.csvの安定文字列キー(例: B1, AIT_PLAZA)を buildings.keyとして取り込めるようSeedBuildingKeysを追加。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
現在APIのbuilding_idはbuildings.building_no(数値、欠番あり)を 参照しているが、将来的に安定した文字列キーbuildings.keyへ移行する 方針のため、移行に必要な対応事項をdocs/schema.mdにTODOとして明記。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
buildings.csv自体にkey列(memo.csv由来の安定文字列キー)を追加したため、 別ファイル(memo.csv)からUPDATEするSeedBuildingKeysは不要になった。 SeedBuildingsをid,key,name,description,affiliation(5列)形式に対応させ、 memo.csvの投入ステップを削除。buildings.csv側がkeyの唯一のソースとなる。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
buildings.csvのid(1,3,4,5...と欠番あり)がbuildings.idとしてそのまま主キーに使われていたが、本来これは安定したPKではなく外部公開用の識別子だったため、buildings.idをDB内部専用のSERIAL主キーに変更building_no(UNIQUE)として分離。nodes/rooms/photos.building_idおよびAPIのbuilding_idは引き続きbuilding_noを参照するため、既存の挙動・API契約は変更なしdb/seeds/memo.csvの安定文字列キー(例:B1,AIT_PLAZA)をbuildings.keyとして取り込むSeedBuildingKeysを追加docs/schema.mdに、将来的にAPIをkeyベースへ移行する方針と残タスクをTODOとして明記Test plan
go build ./...go vet ./...golangci-lint run ./...(0 issues)buildings/nodes/rooms/photosのseed投入と/buildings系APIの応答を確認🤖 Generated with Claude Code