Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for flattening migrations #47

Merged
merged 3 commits into from
Sep 30, 2020

Conversation

Stefanie899
Copy link
Contributor

@Stefanie899 Stefanie899 commented Sep 29, 2020

Added documentation for flattening migrations, as this is something that is rarely done but extremely helpful for larger project.

Testing this would be cumbersome with little benefit in my opinion (the important portion of code, getting the index of the flattened migration in the overall list of migrations, does not lend itself well to testing), so I opted not to write automated tests. Therefore, automated test coverage may decrease from this PR, but it should be minor.

  • [N/A] Related GitHub issue(s) linked in PR description
  • Destination branch merged, built and tested with your changes
  • Code formatted and follows best practices and patterns
  • Code builds cleanly (no additional warnings or errors)
  • Manually tested
  • Automated tests are passing
  • No decreases in automated test coverage
  • Documentation updated (readme, docs, comments, etc.)
  • Localization: No hard-coded error messages in code files (minimally in string constants)

@Stefanie899 Stefanie899 requested a review from a team September 29, 2020 19:34
@codecov
Copy link

codecov bot commented Sep 29, 2020

Codecov Report

Merging #47 into main will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #47   +/-   ##
=======================================
  Coverage   28.29%   28.29%           
=======================================
  Files          60       60           
  Lines         880      880           
  Branches      201      201           
=======================================
  Hits          249      249           
  Misses        631      631           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14ef2af...abeea91. Read the comment docs.

Copy link
Contributor

@brandongregoryscott brandongregoryscott left a comment

Choose a reason for hiding this comment

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

Aside from the comment thought, looks good to me 👍

}
}

public bool ValidateFlattenedShouldRun(string id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick - alphabetization of methods

* In the `FlattenedMigration` class, add a new const for the ID of this migration. It should, when sorted as strings, be next in line from the previous flattened migration. Additionally, add it to the static list that contains all the migration ID consts.
* Open the `Designer.cs` file of the flattened migration, and update the name in the `[Migration("")]` attribute to use the const you just added.
* Rename the files themselves to match what you put in the `[Migration("")]` attribute.
7. Manually update the flattened migration to call `ValidateFlattenedShouldRun` passing in the ID of the migration you are working off of. This will check if, based on the sort order of the other flattened migrations, this flattened migration has not run on a fresh install. If that method call returns false, you should abort running the flattened migration, as it means this is not a fresh install.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can some subset of this comment be added as a comment above the method in that base class?

@Stefanie899 Stefanie899 merged commit 63305bb into rsm-hcd:main Sep 30, 2020
@Stefanie899 Stefanie899 linked an issue Sep 30, 2020 that may be closed by this pull request
@@ -0,0 +1,88 @@
using Microsoft.EntityFrameworkCore;
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome! What are your thoughts on migrating this to the Data.SqlServer package? I set it up this morning being I know we are going to need it. One of our clients could actually use this soon as it is on their backlog. https://github.com/AndcultureCode/AndcultureCode.CSharp.Data.SqlServer

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps projects could extend this, being required to override specific aspects and 'context' be a generic?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for switching gears on your in terms of OSS packages - if you don't have time, we can just create a github issue do to it later on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should be able to migrate this over on Friday. Once I do that, I'll also update this repo to use that package (I'll also address the master vs main issue when I migrate this over).

@@ -0,0 +1,17 @@
# Flattening Migrations

1. Checkout greatest common denominator brach -- typically `master`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Switch 'master' to 'main'

@wintondeshong
Copy link
Contributor

@Stefanie899 sorry, i just noticed i didn't "submit" my review so my comments from early this morning were sitting there pending.

@wintondeshong
Copy link
Contributor

@all-contributors please add @Stefanie899 for code, reviews and documentation

@allcontributors
Copy link
Contributor

@wintondeshong

I've put up a pull request to add @Stefanie899! 🎉

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.

Add documentation re: migration flattening and base migration class.
3 participants