Database versions deployment. Entity Framework Migrations vs SSDT DacPacs
P

2

9

I have a data-centered application with SQL Server. The environments in which it´ll be deployed are not under our control and there´s no DBA in there (they are all small businesses) so we need the process of distribution of each application/database update to be as automatic as possible.

Besides of the normal changes between versions of an application (kind of unpredictable sometimes), we already know that we´ll need to distribute some new seed data with each version. Sometimes this seed data will be related to other data in our system. For instance: maybe we´ll need to insert 2 new rows of some master data during the v2-v3 update process, and some other 5 rows during the v5-v6 update process.

EF

We have checked Entity Framework Db Migrations (available for existing databases with no Code-First since 4.3.1 release), which represents the traditional sequential scripts in a more automatic and controlled way (like Fluent Migrations).

SSDT

On the other hand, with a different philosophy, we have checked SSDT and its dacpacs, snapshots and pre- and post-deployment scripts.

The questions are:

  1. Which of these technologies / philosophies is more appropriate for the case described?

  2. Any other technology / philosophy that could be used?

  3. Any other advice?

Thanks in advance.

Pritchett answered 24/4, 2012 at 10:44 Comment(2)
Best thing I've seen is ready-roll.comSnack
related programmers.stackexchange.com/questions/209815/…Snack
W
3

That's an interesting question. Here at Red Gate we're hoping to tackle this issue later this year, as we have many customers asking about how we might provide a simple deployment package. We do have SQL Packager, which essentially wraps a SQL script into an exe.

I would say that dacpacs are designed to cover the use case you describe. However, as far as I understand they work be generating a deployment script dynamically when applied to the target. The drawback is that you won't have the warm fuzzy feeling that you might get when deploying a pre-tested SQL script.

I've not tried updating data with dacpacs before, so I'd be interested to know how well this works. As far as I recall, it truncates the target tables and repopulates them.

I have no experience with EF migrations so I'd be curious to read any answers on this topic.

Woosley answered 26/4, 2012 at 14:53 Comment(3)
-1 You didn't answer the question (no experience with EF migrations, no experience upgrading database with dacpacs), but definitely advertised your product.Reamy
I'm sorry you feel this way and I am inclined to disagree with you. Gus asked three questions and I answered the second: "Any other technology/philosophy?". Yes, I mentioned a product I am responsible for, which certainly isn't against the rules. Although I've not used them in anger, I've tested dacpacs and understand their limitations. Yes, my practical experience with EF migrations is limited, which is why I declared it.Woosley
I am sorry. I wasn't observant enough and you are right. I would like to remove downvote, but I can't until the answer is edited. Please exuse me :)Reamy
P
1

We´ll probably adopt an hybrid solution. We´d like not to renounce to the idea deployment packagers, but in the other hand, due to our applications´s nature (small businesses as final users, no DBA, no obligation to upgrade so multiple "alive" database versions coexisting), we can´t either renounce to the full control of the migration process, including schema and data. In our case, pre and post-deployment scripts may not be enough (or at least not comfortable enough ) for a full migration like EF Migrations are. Changes like addind/removing seed data, changing a "one to many" to a "many to many" relationship or even radical database schema changes (and, consequently , data migrations to this schema from any previous released schema) may be part of our diary work when our first version is released.

So we´ll probably use EF migations, with its "Up" and "Down" system for each version release. In principle, each "Up" will invoke a dacpac with the last database snapshot (and each Down, its previous), each one with its own deployment parameters for this specific migration. EF migrations will handle the versioning line, an maybe also some complex parts of data migration.

We feel more secure in this hybrid way. We missed automatization and schema changes detection in Entity Framework Migrations as much as we missed versioning line control in Dacpacs way.

Pritchett answered 27/4, 2012 at 8:24 Comment(1)
Having used FluentMigrator in the past, I don't understand why you aren't just using that. It's open source, so if you don't like how something works you are free to change it. It seems like it'll do everything you need.Marvismarwin

© 2022 - 2024 — McMap. All rights reserved.