Skip to content

Conversation

@Volte6
Copy link
Member

@Volte6 Volte6 commented Jun 22, 2025

Description

This defines a basic process for including auto-correcting/updating of datafiles etc. when users upgrade to a new binary version.

Changes

  • main.go now defines VERSION - this should match release versions
  • internal/migration/ code foor migration purposes.
  • migration code is invoked in main.go before datafiles etc. are loaded (except for config)
  • fixes a small error in training room script
  • migration creates a backup of datafiles and restores on any errors
  • flag --version can be used when running gomud to display version and quit
  • version set to 0.9.1

@Volte6 Volte6 requested review from Jasrags and MorquinDevlar June 22, 2025 04:08
Copy link
Contributor

@MorquinDevlar MorquinDevlar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is a good idea, although I don't see any kind of backup being taken before migration is done. If migration fails, there is seemingly no way to get back to the previous version.

Also, I don't see any validation for loading zone config's, and potentially adding missing ones before migration. Just an observation.

Comment on lines 51 to 53
func (v Version) IsOlderThan(other Version) bool {
return v.Compare(other) <= Older
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this consider equal versions as older than each other? I would think this should be just < Older

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This < in this case is technically doing a comparison vs. a constant taht's returned. It should really be =.

Fixed.

@Volte6
Copy link
Member Author

Volte6 commented Jun 23, 2025

I think is a good idea, although I don't see any kind of backup being taken before migration is done. If migration fails, there is seemingly no way to get back to the previous version.

Also, I don't see any validation for loading zone config's, and potentially adding missing ones before migration. Just an observation.

A full backup would probably be a decent idea, and then a revert on failure... I'll implement something simple for that.

I'll add some logic to check for a zone-config as well. If it already exists, we can probably ignore the migration for that file... it's should be harmless to leave it in there.

@Volte6 Volte6 marked this pull request as draft June 23, 2025 19:49
@Volte6 Volte6 marked this pull request as ready for review June 23, 2025 21:00
@Volte6 Volte6 merged commit 55240c5 into master Jun 25, 2025
7 checks passed
@Volte6 Volte6 deleted the migration branch June 25, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants