msaccess-vcs-addin icon indicating copy to clipboard operation
msaccess-vcs-addin copied to clipboard

Add option to disable backup creation when overwriting file

Open mmzmusicnotes opened this issue 4 years ago • 8 comments
trafficstars

Could be a settings option, or a yes/no/cancel prompt on overwriting, as part of the "do you want to continue" dialog that pops up.

mmzmusicnotes avatar Nov 30 '20 22:11 mmzmusicnotes

Semi-related: I think instead of a single number for the backups, it would be very useful to have the date / time stamp (or some other field) for this; when building numerous versions, and troubleshooting, having a litany of backups has led to confusion, IMO, adding a date/time instead of a simple number would help (especially since we can't use the date/time of edit / creation as it's set to the current time if you do open it. This would help with order of creation during troubleshooting and you want to see what "version" broke the part you're working on.

hecon5 avatar Jan 15 '21 12:01 hecon5

As I ponder aloud, one option that might be attractive is to have a prompt to allow you to enter what you want as the backup tag, but provide a standard option so you can just click through if you're in a hurry.

Example: Default backup name is date/time, you click build from source, and a prompt opens with the date/time in the box. You are free to hit enter, or enter your own information (such as issue ID, some text, etc.) this could (should?) be added to the "next" time you build, so your next one would be <date/time>

Example 2: same as above, except you enter this in settings (this would be very useful for when working on a single issue and you're doing iterative testing between two or more developers (or just yourself and you're build happy). A date/time would be added to the extension, too. I like this one best, because it requires the least amount of build effort, though would require a new property to be saved in VCS settings.

hecon5 avatar Jan 15 '21 14:01 hecon5

I don't mind adding options that help developers better adapt the add-in to their personal workflows. I don't want to clutter the options with tons of rarely used or edge case details, but this sounds like a reasonable thing that at least a couple people have expressed some interest in.

One idea is that we could add a dropdown selection of a few different options:

  • Increment (Current functionality, similar to how Access creates backup files when recovering a database.)
  • Timestamp (Something like *_YYYYMMDDHHNNSS.accdb)
  • Prompt (Opens a save-as dialog box)
  • Disabled (Does not create a backup. This could have an additional warning since you can easily cause irrecoverable data loss if you forget to export source before building.)

joyfullservice avatar Jan 15 '21 14:01 joyfullservice

I like that; keeps it pretty simple, and allows for 90% of the use cases to be met (the other 10% being used 0.01% of the time).

Provides simple implementations (in fact, I think if you're building from source, you may want a new save-as for each one in many cases), and allows you to go about your business if you just want to build things and move on.

hecon5 avatar Jan 15 '21 15:01 hecon5

One thing I've noticed about the build from source, is that it does NOT use the (current) file name of the open database: it uses the filename of the EXPORTED database. This is odd, as I (personally) don't expect it to change the database name; and I have (in my legacy fork) use it to build several different version from a base section of code and then name the developed version with the issue ID for my own sanity.

That's one thing that I would most like to configure, whether it builds the (currently open) database from the (selected) code base, or builds a brand new file (and overwrites another) from the code base.

Hopefully that makes sense.

hecon5 avatar Jan 15 '21 15:01 hecon5

ISO8601 states that the letter "T" be used to separate date from time.

EXAMPLE: .Format$(yyyyMMddThhmmss)

Optionally, you can convert to Zulu time and add a Z at the end if your software is used in multiple timezones.

A9G-Data-Droid avatar Apr 30 '21 19:04 A9G-Data-Droid

@A9G-Data-Droid, thanks for this! While I don't forsee sharing (many) copies of the built database with my other devs, we're scattered across numerous time zones, so I really like the idea of converting to Zulu to avoid confusion, especially in released versions.

hecon5 avatar May 11 '21 13:05 hecon5

@hecon5 Here is a function that will give you ISO time stamps in either local or UTC time:

''' ISO Compliant file timestamp
Public Function ISOTimeStamp(Optional ByVal zulu As Boolean) As String
    If zulu Then
        ISOTimeStamp = Format$(ConvertUTC(Now), "yyyyMMddThhmmssZ")
    Else
        ISOTimeStamp = Format$(Now, "yyyyMMddThhmmss")
    End If
End Function

''' Returns UTC time from date passed in.
Public Function ConvertUTC(ByVal timestamp As Date) As Date
    With CreateObject("WbemScripting.SWbemDateTime")
        .SetVarDate timestamp
        ConvertUTC = .GetVarDate(False)
    End With
End Function

A9G-Data-Droid avatar May 11 '21 15:05 A9G-Data-Droid