question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Addition of new Command: delete

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Aniruddh25commented, Jul 19, 2022

Need a option for delete mappings section

0reactions
severussundarcommented, May 16, 2023

Thanks for the suggestion. When you get a chance, please elaborate with more details and usage examples for each of the commands - updateWithReplace, updateWithSet and updateWithAdd.

Adding more context: In this discussion thread, one of the users had requested a way for removing an incorrectly created relationship.

Read more comments on GitHub >

github_iconTop Results From Across the Web

new and delete Operators in C++ For Dynamic Memory
Since it is the programmer's responsibility to deallocate dynamically allocated memory, programmers are provided delete operator in C++ language ...
Read more >
How to Add and Delete Users on Ubuntu 20.04
Adding and removing users on a Linux system is one of the most important system ... you can add a new user with...
Read more >
All the Ways to Add and Remove Items from a List in Python
This method takes two arguments: the index where the new element needs to be added and the element value. Example: >>> fruits =...
Read more >
How to Add and Delete Users in Command-Line in Ubuntu
Learn the easier and more user-friendly ways of creating a new user and removing existing users in the Ubuntu command line.
Read more >
Remove space after command - macros
If your command is truly a single macro without arguments, i.e. \cmd , then it gobbles spaces written after it anyway.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found