Draft
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds a new config_properties table for storing additional properties of config items and introduces the corresponding Go model.
- Defines
config_propertiesschema with columns, indexes, and a check constraint for text/value exclusivity - Implements
ConfigPropertystruct in Go with GORM mappings - Sets up foreign keys to
config_itemsandconfig_scrapers
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| schema/config_properties.hcl | Creates config_properties table with all necessary columns and constraints |
| models/config_properties.go | Adds ConfigProperty struct, TableName, PK, and PKCols methods |
Comments suppressed due to low confidence (2)
models/config_properties.go:11
- New model
ConfigPropertylacks unit or integration tests. Consider adding tests for CRUD operations and validation of the check constraint(text IS NOT NULL AND value IS NULL) OR (text IS NULL AND value IS NOT NULL).
type ConfigProperty struct {
models/config_properties.go:27
- [nitpick] The field name
Typemaps to a column namedtype, which is a reserved word in many SQL dialects. It's clearer to add an explicit tag:gorm:"column:type;default:NULL"to ensure correct mapping.
Type string `json:"type,omitempty" gorm:"default:NULL"`
addc663 to
096addc
Compare
096addc to
0cae48b
Compare
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.
related: flanksource/config-db#1559
Removed fields:
[]links(we can just add a new property with value as the URL),status,lastTransition,headline,hidden,