Skip to content

[CLI]: New command/verb: delete #642

@abhishekkumams

Description

@abhishekkumams

Command 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 the target.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

Metadata

Metadata

Assignees

Labels

clienhancementNew feature or requestmove-to-closeLacks clarity or roadmap mismatch

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions