Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Skip settings migration if the settings value has not been changed #874

Merged

Conversation

unnawut
Copy link
Contributor

@unnawut unnawut commented Mar 22, 2019

Issue/Task Number: #798
Closes #798

Overview

This PR skips migration of a specific settings if the settings value has not been changed.
This helps remove unnecessary database writes and activity logs caused by unchanged settings updates.

Changes

  • Updated EWallet.ReleaseTasks.ConfigMigration to skip updating if a settings value is unchanged.

Implementation Details

The Settings and StoredSettings is pretty complicated and adds a lot of changes to the changeset. Since this settings migration command mainly takes ENV values and saves to database, this PR skips unnecessary DB updates by checking whether the settings value changed. Only if it changed then it proceeds with the update.

Usage

Running this command the first time:

BASE_URL=http://localhost mix omg.config -m -y

Would result in:

Migrating the settings to the database...
  - Setting `base_url` to "http://localhost"... Done.

However, running it with the same value again would result in:

Migrating the settings to the database...
  - Setting `base_url` is already "http://localhost"... Skipping.

Impact

No changes to API specs or DB schemas.

@unnawut unnawut added this to the v1.2 milestone Mar 22, 2019
@unnawut unnawut self-assigned this Mar 22, 2019
@unnawut unnawut requested review from sirn and T-Dnzt March 22, 2019 15:32
@ghost ghost added the s2/wip 🚧 label Mar 22, 2019
@unnawut unnawut merged commit b4d97a0 into omgnetwork:v1.2 Mar 26, 2019
@ghost ghost removed the s3/review 👀 label Mar 26, 2019
@unnawut unnawut deleted the 798-skip-unchanged-config-migration branch March 26, 2019 08:22
@T-Dnzt T-Dnzt added this to Done in eWallet Apr 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
eWallet
  
5-Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants