Skip to content

Commit

Permalink
style: format
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusz-wozniak committed Sep 27, 2024
1 parent a9cd279 commit a071482
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions data/blog/optimizely/how-to-remove-obsolete-commerce-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ summary: By default Optimizely code does not remove properties from the database

By default, Optimizely code does not remove properties from the database when you remove them from the code. This article describes how to remove obsolete Commerce data and introduces the Opti.Addons project.

# Introduction
### Introduction

When we develop a project, we often add new properties to the classes. However, when we remove them, the properties are not removed from the database. This can lead to a situation where the database contains obsolete data that is no longer used in the code. This article describes how to remove that data.

Historically, it was possible in the old Episerver Commerce, but that feature is gone as for now.

# Automatically
### Automatically

I just created the [Opti.Addons](https://github.com/Opti-Addons) project which in future will contain small handy tools for Optimizely. The first tool is called [DeleteMissingCommercePropertiesScheduledJob](https://github.com/Opti-Addons/Opti.Addons.DeleteMissingCommercePropertiesScheduledJob) and is basically a scheduled job that removes obsolete properties from the database. In order to use it, just install the NuGet package and see two scheduled jobs: one for the listing of properties that are not in the code and the second one for removing them.

# Manually
### Manually

Well, you might want to create a migration step, some initializable code, or any other way to remove the properties. Just re-use (read: copy and paste) the code from the project: [MissingCommercePropertiesService.cs](https://github.com/Opti-Addons/Opti.Addons.DeleteMissingCommercePropertiesScheduledJob/blob/main/MissingCommercePropertiesService.cs).

Expand Down

0 comments on commit a071482

Please sign in to comment.