models/db: introduce TargetEnvironment side-table; batch attach on reads; add CRUD tests
- Add internal-only fields to models.TargetEnvironment:
* ID (uuid, PK)
* ModelRelatedInformationID (FK -> model_related_informations.id)
Both are tagged with json:"-" so the public API remains unchanged.
- Migration:
* AutoMigrate(&ModelRelatedInformation{}, &TargetEnvironment{}) so
target_environments has 5 columns:
(id, model_related_information_id, platform_name, environment_type, dependency_list).
* For existing DBs, legacy rows without model_related_information_id need
backfill or archival; otherwise they will not attach to parents.
- Fixes the registration error:
"column model_related_information_id does not exist".
- Tests:
* Add CRUD unit test (TestCRUD_Subtests) covering create/read/replace/partial(nil)/clear([])/delete.
All pass with -race.
Change-Id: Id57bf7721ce2295fceb394a0dd82feab72e60a95
Signed-off-by: alswp006 <alswp006@gmail.com>