Skip to content

Commit

Permalink
fix: reset data with migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
scaljeri committed Nov 12, 2021
1 parent d42c780 commit 5abeb25
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oh-my-mock",
"version": "3.0.2",
"version": "3.0.3",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
1 change: 1 addition & 0 deletions src/shared/utils/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class MigrateUtils {
return data;
}

// `version` > `MigrateUtils.version`
if (compareVersions(version, MigrateUtils.version) === 1) { // Can only happen with JSON imports
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/migrations/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const VERSION = '__OH_MY_VERSION__';

export const mockSteps = [
(data) => {
if (compareVersions(data.version || '0.0.0', '3.0.0') === -1) { // Everything before 3.0.0 is discarded
if (compareVersions(data.version || '0.0.0', '3.0.3') === -1) { // Everything before 3.0.3 is discarded
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/migrations/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const VERSION = '__OH_MY_VERSION__';

export const requestSteps = [
(data) => {
if (compareVersions(data.version || '0.0.0', '3.0.0') === -1) { // Everything before 3.0.0 is discarded
if (compareVersions(data.version || '0.0.0', '3.0.3') === -1) { // Everything before 3.0.3 is discarded
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/migrations/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const VERSION = '__OH_MY_VERSION__';

export const stateSteps = [
(data) => {
if (compareVersions(data.version || '0.0.0', '3.0.0') === -1) { // Everything before 3.0.0 is discarded
if (compareVersions(data.version || '0.0.0', '3.0.3') === -1) { // Everything before 3.0.3 is discarded
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/migrations/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const VERSION = '__OH_MY_VERSION__';
export const storeSteps = [
(data) => {
data.version = '0.0.0';
if (compareVersions(data.version || '0.0.0', '3.0.0') === -1) { // Everything before 3.0.0 is discarded
if (compareVersions(data.version || '0.0.0', '3.0.3') === -1) { // Everything before 3.0.3 is discarded
return null;
}

Expand Down

0 comments on commit 5abeb25

Please sign in to comment.