In Depth Entity Framework Migrations with Postgres
HTML-код
- Опубликовано: 27 ноя 2024
- Learn how to use Entity Framework Migrations in .Net 7. I go over how to create migrations, remove migrations, apply migrations to the database, and revert migrations.
Also see how to update the database using two alternative methods, generating a sql script, and generating a bundle.
dotnet ef cli tools reference:
learn.microsof...
EF Migrations overview. This whole docs section is a great reference to a lot of the commands I used in this video:
learn.microsof...
EF Core Nuget package for Postgres
www.nuget.org/...
Follow me on social media!
Twitter: / scriptbytesio
Instagram: / scriptbytes
Superb Nice Explanation
Great! Thanks! Just started looking at PostgreSQL as an alternative to SQL Server
Great Work!, You don't know how much this video tutorial has helped me to understand the Migrations Topic Keep the good work!
I appreciate it! I’m glad the video helped! Thanks for watching.
Phenomenally explained! Thank you! Please make more videos, regarding other Postgres features that EF Migrations can handle (can it do triggers and storedprocs?)
Thank you. I may be doing more in the future, but yes, you can script things like stored procedures. Look into the MigrationBuilder.Sql(...) method. It allows you to run sql, which you can use to run your 'create procedure' scripts.
Great high quality explanation. Thanks!
You’re welcome, thanks for watching!
Thanks for the Video very good explanation !
Exceptional work! Thank you!!
Glad you enjoyed it!
Awesome video. Learnt so much :)
Amazing! Thanks and Congrats...
Saved my day!
I’m glad it helped!
Fantastic video
Thanks!
hi, i have some issue when i migrated with enum data type, inside my db it should be enum instead of int do you know how to fix that?
awesome guide!
Thanks!
It was an amazing migrations tutorial. Could you please make a tutorial for how to seed in a table? looking forward to seeing it. thanks again
That’s a great idea. I’ll add it to my list.
Thanks for watching!
I put out a video today on seeding data. Let me know what you think!
Thanks for sharing
Thanks for watching!
This was incredibly helpful, thank you so much!
You’re welcome!
Scripts @ 23:32 with -o and idempotent switch
hello I faced to this error how to fix
dotnet ef migrations add initialMigration
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Do you run postgresql on production server as linux daemon or docker container?
It all depends on what you're comfortable with. I enjoy docker because it's easy to stand up a database with it.
For production, depending on the size and demand, it might be worth looking into a service like Cloud SQL to host the DB as well.
@@scriptbytes Is there a huge difference in performance and resource draining in these two approaches?
@@adam-xt8te I don't have enough experience with both to know if there's much of a difference.
However from what I've seen from benchmark results, there's little to no difference between docker and native run postgres DB's. Not enough to matter for the vast majority of use cases anyways.
how to call sp in PostgreSQL that returns rows ?
You would probably want to use FromSql:
learn.microsoft.com/en-us/ef/core/querying/sql-queries
@@scriptbytes thanks for ur reply. Actually I did use it. But in postgresql, if ur sp returns rows it has to have a refcursor which will contain rows and when u call sp from c# u need to run call ur_sp(params, 'cur'); fetch all in "cur". So this command not working if we use ef