Addition of new Command: delete
See original GitHub issueCommand Name:
delete
delete
command will allow users to remove fields from the config file.
Proposed Usage:
Deleting a relationship
dab delete <<entity_name>> --relationship "<<relationship_name>>"
An entity can have many relationship fields defined in the config file like below.
"relationships": {
"publishers": {
"cardinality": "one",
"target.entity": "Publisher"
},
"reviews": {
"cardinality": "many",
"target.entity": "Review"
},
"authors": {
"cardinality": "many",
"target.entity": "Author",
"linking.object": "book_author_link",
"linking.source.fields": [
"book_id"
],
"linking.target.fields": [
"author_id"
]
}
},
When a relationship name that exists in the config file is specified, then that particular relationship should be removed.
When *
is specified as the relationship name, then all the relationships defined for that entity should be removed from the config file.
Deleting a mapping
dab delete <<entity_name>> --mapping "<<column_name>>"
When a valid column_name
is specified, the mapping defined for that column should be deleted.
When *
is specified, then mappings defined for all the columns should be removed from the config file.
Delete a particular role
dab delete <<entity_name>> --permissions "<<role_name>>"
When a valid role_name
is specified, it should be removed from the permissions
object. However, if it is the only role
present, it should result in an error as it is not possible to have an entity without any permissions defined.
Deleting an entity
dab delete <<entity_name>>
- When an entity that is not present in the config file is specified, it should result in an error.
- It is possible that the entity specified in the config file could have relationships defined on it. There could be other entities in the config file that could have a
relationship
defined with this specified entity as thetarget.entity
. If such a case is identified, then the command should result in an error with a suggestion that these relationships need to be deleted before deleting the entity. - When the entity to delete is not part of any of the relationships defined in other entities, then the entity specified should be removed from the config file.
Deleting all entities
dab delete *
This essentially resets the entire config file. All the entities that were created will be removed. The resulting config will look the same as it was after running only the init
command
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Need a option for delete
mappings
sectionThanks for the suggestion. When you get a chance, please elaborate with more details and usage examples for each of the commands -
updateWithReplace
,updateWithSet
andupdateWithAdd
.Adding more context: In this discussion thread, one of the users had requested a way for removing an incorrectly created relationship.