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

Add models and initial migration for database #24

Merged
merged 6 commits into from
Nov 26, 2022

Conversation

kirkbrauer
Copy link
Member

@kirkbrauer kirkbrauer commented Nov 25, 2022

Description

Added database models and EF Core configurations for the entire Mastodon database including stored procedures and materialized views. There were some issues with the dotnet ef dbcontext scaffold, so I have manually modified all the generated configuration files to fix those differences between what EF Core generated and the actual database. There are also some warnings about default values, which have CLR defaults and database defaults, I have chosen to ignore those warnings for now, but we can decide if those properties should be made nullable to disable those warnings.

Fixes #17 #10

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

I have tested this migration use dotnet ef database update on my local machine running PostgreSQL 15.

Test Configuration:

  • Hardware: macOS 12.6 Intel
  • SDK: 7.0.0
  • PostgreSQL 15

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@benrick benrick self-requested a review November 26, 2022 00:57
@benrick
Copy link
Member

benrick commented Nov 26, 2022

I'll try to run this one locally today or tomorrow. I've looked through the code already. I want to get at least one other person to try running it.

@edmistond
Copy link
Contributor

I'll pull this down to my Mac tonight and see if EF will apply the updates to a clean fresh Postgres 15 instance. Guess it gives us a chance to see if they'll work on ARM, too. :)

@edmistond
Copy link
Contributor

Runs clean against Postgres 15 (via Postgres.app) on my M1:

❯ dotnet ef database update
Build started...
Build succeeded.
Applying migration '20221125033633_InitialCreate'.
Done.

I see 91 tables, 3 materialized views, and 1 view.

Copy link
Member

@benrick benrick left a comment

Choose a reason for hiding this comment

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

Tested migration locally and accessing database from app.

@benrick benrick merged commit f02ab0e into DevChatter:main Nov 26, 2022
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.

Database and Change Management for Initial Data Storage
3 participants