Giter Site home page Giter Site logo

sf_stats's Introduction

SF_Stats

.NET CodeQL

Dev Setup

Install Visual studio

Download Visual Studio

Install SQL Server

Download SQL Server Express and install it. You will need admin privlages and TLS enabled.

Update the server name for the ConnectionStrings in the appsettings.Local.json file from the sf_stats.Api project to your local SQL Server instance name. appsettings.Local.json will be ignored by git in the future.


!! - Currently the Development appsettings is being incorrectly loaded. For now, change the server name in appsettings.Development.json, but do not commit the changes


Install EF Core Tools

To enable the ability to migrate db changes via the command line, EF Core Tools needs to be installed. It is recommended to install the tool set globally.

To install the tools use the following command:


dotnet tool install --global dotnet-ef

To migrate the tools to the latest version use the following command:


dotnet tool update --global dotnet-ef

How To Migrate Database Changes

You can update your database with the latest migrations using either EF Core Tools or the EF Core Design Tools nuget package. Under the hood, they are the same. EF Core Design Tools wrap EF Core Tools in powershell and at times it can be a bit more convienient to use them from within Visual Studio. Use whatever method you prefer.

How To Migrate Database Changes using EF Core Design Tools (Powershell)

EF Core Design Tools is a nuget package that includes the EF Core Tools functionality in powershell commands. This is an easy way to generate and apply migrations from within visual studio itself. This method can be more convienent when working withing visual studio itself.

Open Package Manager Console

You can do this from the Package Manager Console which can be opened via View > Other Windows > Package Manager Console

Make sure to set Default project to sf_stats.DataAccess.MSSql

Update Database

Update to most recent migration

update-database

Update (or Rollback) to a specific migration

update-database <migration-name>
Add A Migration

After completing code changes:

add-migration <migration_name>

This will generate a new migration and add it to the Migrations folder of the sf_stats.DataAccess.MSSql project

Remove A Migration

To remove the most recently added migration, run

remove-migration

How To Migrate Database Changes using EF Core Tools

This project is using a code-first approach for migrating data changes to the database (Microsoft SQL Server).

To migrate database changes to the latest version

dotnet ef database update --project csprojpath

Note: This is a relative path from the root of the repository.

To revert a change or to update the database to a specific migration

dotnet ef database update <migration_name/migration_id> --project csprojpath

Note: This is a relative path from the root of the repository.

Note2: If a value of 0 is passed in as a parameter it will revert the database to an empty state.

sf_stats's People

Contributors

gcherry avatar joshuatland avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.