Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

After deleting a project cannot create with the same name. #20

Open
ashutoshd11 opened this issue Feb 10, 2025 · 8 comments · May be fixed by #31
Open

After deleting a project cannot create with the same name. #20

ashutoshd11 opened this issue Feb 10, 2025 · 8 comments · May be fixed by #31

Comments

@ashutoshd11
Copy link
Collaborator

ashutoshd11 commented Feb 10, 2025

Steps to Reproduce

  • Deleted the project.
  • Create it again with the same name.
@ashutoshd11
Copy link
Collaborator Author

This behaviour is because of soft delete[Not actually deleting them from DB] of projects.
Happens because of uniqueness constraint on project name.

@sachdevavaibhav
Copy link

@ashutoshd11 Can I take up this issue and create PR for this? It will also solve #21

@ashutoshd11
Copy link
Collaborator Author

@sachdevavaibhav , thank you for showing interest; your input would very helpful for us.

Here are some pointers to keep in mind during development:

Avoid Hard Deletion:

Hard deleting a project from the database is not advisable because it would also delete all its test cases and runs due to cascading logic. We cannot afford this, as it would make the deleted project unrecoverable.

Implementing Soft Deletion:

In our current implementation, when updating the project status to “deleted” in the database, we also rename the project to projectName_deleted. This allows a new project with the same original name to be created. However, this introduces a challenge: if a project with the name projectName_deleted already exists, deleting the newly created project becomes problematic. We need to implement logic that checks for existing variations (e.g., _deleted, _deleted1, etc.) and updates the name accordingly during deletion.

In the future, we will add a feature to recover deleted data, providing an extra layer of data safety and flexibility.

@sachdevavaibhav
Copy link

@ashutoshd11 , I understood that we need to perform soft delete. However I have a suggestion, we can put timestamp at the end of project name projectName_{timestamp} when soft deleting the project.
After deleting the name would look like: projectName_2011-10-05T14:48:00.000Z.

In future when you will add feature to recover deleted data you can simply remove anything after the last underscore while making sure another project with same name does not exist.

What do you think about this?

@ashutoshd11
Copy link
Collaborator Author

ashutoshd11 commented Feb 24, 2025

@sachdevavaibhav this would also works 👍 .

@sachdevavaibhav
Copy link

@ashutoshd11
Right now when I click on delete project button on the table it marks it as Archived and not Deleted. I am not able to see any option to restore it.
Also, where does it get marked as Deleted then?
Do you want me to change the name of the project when it gets marked Archived?

@ashutoshd11
Copy link
Collaborator Author

ashutoshd11 commented Feb 24, 2025

@sachdevavaibhav feature to restore project is not yet implemented.
We are showing only the projects in the list whose status is Active, after deletion there status is marked as Archived

@sachdevavaibhav sachdevavaibhav linked a pull request Feb 28, 2025 that will close this issue
1 task
@ashutoshd11
Copy link
Collaborator Author

ashutoshd11 commented Mar 4, 2025

Thanks @sachdevavaibhav , added comments in PR.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants