Ey everyone! :)
I have been having a look at Flyway but I am not sure about how I can use it. In my case, I have an entity model (annotated using JPA) and, for me, the useful it would be that FlyWay could find out the changes on my model every time I call "migration" and generate the migration files. That is the way such as Rails works (Rails uses a DSL but I hope you understand what I mean). As I have read in the wiki, Flyway does not work in that way but needs the migration files (sql or Java).
If I integrated Flyway in my application (programmatic), could I generate those migration files? I think the answer is "no", that way only would give me control over migrations from Java code.
Am I right?
Thanks in advance :)
This is not currently supported.
Feel free to file a request in the issue tracker: https://github.com/flyway/flyway/issues?state=open
Flyway would have to delegate this to the jpa implementation you're using so it would be tricky.
What I would suggest however is that you use the JPA implementation to generate migration scripts that you then plugin into flyway. It's fairly simple with openjpa, don't know about the others.
Related
I need to do a POC on Dotnet core Microservices with CQRS pattern and MongoDb as nosql database, I don't know where to start, please help
Please ask for a specific problem and do some work of your own before asking.
That said, there is a rather nice nuget package for .Net for working with MongoDB here: https://www.nuget.org/packages/MongoDB.Driver/
Personally I have no expertise with CQRS, however I found this which may help: CQRS Read models in a NoSql (Mongo DB)
There is also a nuget package for using mongodb with cqrs.net here: https://www.nuget.org/packages/Cqrs.MongoDB/
This is very subject question and there might not be any right answer. First you need to understand if you really need CQRS. This pattern generally goes with Event Sourcing .CQRS is only required in some cases where system Read and write has to be separated.
Before you go into CQRS and event sourcing , i would strongly recommend to understand your requirements since it will make your application logic complex.
This example covers all of the microservices concepts in a single project .
https://github.com/EdwinVW/pitstop/
We have a database which stores, among others, identifiers from an external system. Now the identifiers changed (the system changed the scheme), and the database needs to be updated. It can be done - I have a mapping so I can generate just enough SQL to make it work, and in the end this will need to be done like this.
The question is - is this use case for a Flyway Java migration? I tend to think that it's not the case, but I can't really say why, it's a gut feeling. But, the external system's schema is not versioned, at least not by us, so I feel it doesn't fit into out Flyway migrations at all; I think it should be executed just once, outside of Flyway.
Can anybody with more experience maybe help, explain why or why not?
It's mostly opinion based, but it seems to me as it's just the same as to use a steam-hammer to crack nuts. Flyway is a very useful tool for periodical migrations and for cases, then there is a number of databases, you have to recreate from the scratch or update'em regularly, rather then for a single use.
What is the reason to include some relatively large framework in your project, spend some time to make it work, and use it only once? Furthermore, Flyway need some extra table to exist in your DB to store it's inner info about the the current version and applied migrations. Don't think, that is the thing you really want to have in your case.
As for me, I think that if you have to do this task just once and can do it without Flyway, then just do it this way.
I think one question we should be asking ourselves when we determine whether or not to write a Flyway script for our data migrations is "Is this necessary when creating this db from scratch?"
Flyway uses a versioning system so in your case, would it make sense to flip the values from the old version to the new version when standing up a new environment? What about multiple modifications? Does it make sense to store the old values and apply them sequentially if you are creating a new environment?
If you answer "NO", then flyway is probably not the way to go. Flyway is better utilized for schema changes where the structure of the database is changed and data is converted into the new structure. If you're just changing configuration values, I believe flyway is probably not your best bet, simply because it is not necessary to store all the changes to these configuration values.
I'm just discovering ServiceStack for the first time this weekend and I find it completely amazing. As such, I'm already in the process of converting all of my projects over to it. Then I ran into a small snag.
I can't find any documentation that mentions using OrmLite starting with the database first and then mapping an existing schema into POCOs.
I've found plenty of material on code-first, but nothing on model-first.
Is there a way to use OrmLiite taking a model-first approach?
Thank you.
OrmLite is primarily a code-first ORM, but if you want to start with an existing database you would just create a POCO with properties that maps 1:1 to an existing Table and columns.
It's trivial to infer a POCO manually, but if you want some code-gen tool to help do this, OrmLite includes a couple of T4 scripts you could use instead.
I am new to NHibernate and am working on an ASP.NET webforms project that references another assembly that uses NHibernate. I can make calls to methods that use NHibernate on my local copy, but when I publish the project to the test server, I get this:
could not instantiate CacheProvider: NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache
I apologize for the vague nature of this question, but, given what little I know about NHibernate at this point, it's all I can really offer. Perhaps a light might come on for some gurus out there who caught on to the fact that it works when debugging locally, but not when published.
If more info is needed on this in order to provide an answer, just let me know what it is.
Have you confirmed that the published project includes NHibernate.Caches.SysCache.dll in the bin folder? If not, try adding that as a reference and republishing. Sounds like it just can't find the dll.
you need to deploy the nh syscache assembly with the project.
For anyone familiar with Python/Django and the South migration module, I'm trying to find the asp.net MVC3 version if it exists.
What I'm trying to accomplish is create an entity, insert data, and in the future change my model and have the database incorporate the new data appropriately. I want to avoid manual SQL changes.
Does this exist in C# and is it reliable? I've read a bit about the DBInitializers, I'm not really okay with deleting all my data, test data or not, every time an entity needs an update.
Third party package is an acceptable solution (preferably from NuGet) if it has an active user base.
It sounds like you're looking for a good combo ORM and migrations tool. I'm not super familiar with Django, but I've done some work with Rails, and at a glance South looks a bit like ActiveRecord + rake. Does that sound accurate?
The best ORM I've worked with for .NET is EntityFramework 4.1 (i.e. - EF Code First) which is available here. It just happens to be the most downloaded package on NuGet.
Microsoft has released a migrations package for EF that's also available on NuGet. Scott Haneslman blogged about it a little while back.
You could also look into NHibernate as some people swear by it. I've personally never used it, but I've heard great things.
Hopefully that gets you started in the right direction.
// Edit
Doing a little bit more digging around on NuGet, I stumbled on Fluent Migrator which looks promising. Perhaps a better alternative to the EF Migrations package for now...