Skip to content

Do not hardcode date when updating VersionInfo table #1846

Description

@nathanpovo

Is your feature request related to a problem? Please describe.
The VersionInfo table has the column AppliedOn to note when a migration was applied on the database.

The AppliedOn column value is updated with the expected date when updating a database through a direct connection but it uses a hardcoded date when generating SQL scripts.

Describe the solution you'd like
SQL scripts use a date calculated when the script is executed rather than the date when the script was generated.

Additional context
The date is hardcoded in the implementations of IVersionLoader (note the value that is used for the AppliedOn column):

protected virtual InsertionDataDefinition CreateVersionInfoInsertionData(long version, string description)
{
return new InsertionDataDefinition
{
new KeyValuePair<string, object>(VersionTableMetaData.ColumnName, version),
new KeyValuePair<string, object>(VersionTableMetaData.AppliedOnColumnName, DateTime.UtcNow),
new KeyValuePair<string, object>(VersionTableMetaData.DescriptionColumnName, description),
};
}

protected virtual InsertionDataDefinition CreateVersionInfoInsertionData(long version, string description)
{
return new InsertionDataDefinition
{
new KeyValuePair<string, object>(VersionTableMetaData.ColumnName, version),
new KeyValuePair<string, object>(VersionTableMetaData.AppliedOnColumnName, DateTime.UtcNow),
new KeyValuePair<string, object>(VersionTableMetaData.DescriptionColumnName, description)
};
}

Is this a feature you'd like to submit a PR for?
Yes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions