-
Notifications
You must be signed in to change notification settings - Fork 8
/
migrations.sh
30 lines (23 loc) · 1.28 KB
/
migrations.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Append the flag --verbose to see the log of execution of the commands and error
# stacktrace if the command fails
dotnet ef ........ --verbose
# To create your migrations.
# Note that you need to be in the directory of the project with the ef dependency
# added to (in our case it's the Infrastructure, so cd Infrastructure)
# and the "Design" ef library should be added to the project with the starting point
# and you have to pass the starting point directory as a startup project parameter
dotnet ef migrations add [YourMigrationName] --startup-project ../Presentation
# To reflect the latest changes of your code on your database
dotnet ef database update
# You choose a specific name of the migrations
dotnet ef database update [YourMigrationName]
# The -- token directs dotnet ef to treat everything that follows as an
# argument and not try to parse them as options. Any extra arguments not
# used by dotnet ef are forwarded to the app.
dotnet ef database update -- --environment Production
# You can add a connection string
dotnet ef database update --connection [YourConnectionString]
# To specify your startup project
dotnet ef database update --startup-project ../Presentation
# To delete a created migration
dotnet ef migrations remove [YourMigrationName] --startup-project ../Presentation