cli(squash): add set_table_is_enum metadata type (close #4394) (#4395)

This commit is contained in:
Aravind Shankar 2020-04-14 16:39:41 +05:30 committed by GitHub
parent a23c633bd7
commit 21a4dff993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -10,6 +10,7 @@ The order and collapsed state of columns is now persisted across page navigation
### Bug fixes and improvements
- cli: set_table_is_enum metadata type for squashing migrations (close #4394) (#4395)
- console: query support for actions (#4318)
- cli: query support for actions (#4318)
- cli: add retry_conf in event trigger for squashing migrations (close #4296) (#4324)

View File

@ -422,6 +422,11 @@ func (q CustomQuery) MergeTables(squashList *database.CustomList) error {
}
}
prevElems = append(prevElems, element)
case *setTableIsEnumInput:
if tblCfg.GetState() == "untracked" {
return fmt.Errorf("cannot set table %s on schema %s has a enum when it is untracked", tblCfg.name, tblCfg.schema)
}
prevElems = append(prevElems, element)
}
}
}
@ -993,6 +998,11 @@ func (h *HasuraDB) Squash(l *database.CustomList, ret chan<- interface{}) {
args.Table.Name,
args.Table.Schema,
}
case *setTableIsEnumInput:
return tableMap{
args.Table.Name,
args.Table.Schema,
}
case *createEventTriggerInput:
return tableMap{
args.Table.Name,
@ -1194,6 +1204,8 @@ func (h *HasuraDB) Squash(l *database.CustomList, ret chan<- interface{}) {
case *trackTableV2Input:
q.Version = v2
q.Type = trackTable
case *setTableIsEnumInput:
q.Type = setTableIsEnum
case *unTrackTableInput:
q.Type = untrackTable
case *setTableCustomFieldsV2Input:

View File

@ -66,6 +66,8 @@ func (h *newHasuraIntefaceQuery) UnmarshalJSON(b []byte) error {
}
case setTableCustomFields:
q.Args = &setTableCustomFieldsV2Input{}
case setTableIsEnum:
q.Args = &setTableIsEnumInput{}
case untrackTable:
q.Args = &unTrackTableInput{}
case createObjectRelationship:
@ -250,6 +252,7 @@ const (
trackTable requestTypes = "track_table"
addExistingTableOrView = "add_existing_table_or_view"
setTableCustomFields = "set_table_custom_fields"
setTableIsEnum = "set_table_is_enum"
untrackTable = "untrack_table"
trackFunction = "track_function"
unTrackFunction = "untrack_function"
@ -361,6 +364,11 @@ type setTableCustomFieldsV2Input struct {
tableConfiguration
}
type setTableIsEnumInput struct {
Table tableSchema `json:"table" yaml:"table"`
IsEnum bool `json:"is_enum" yaml:"is_enum"`
}
type unTrackTableInput struct {
tableSchema
}