I need to load data from an old DB into a migrated schema of this DB using Doctrine migration system.
I guess Doctrine might help me in this process.
I tried and lost a few hours using ETL scripts programs, without success.
From my point of view I need to :
Create a DB with the V0 schema
Load the data from the old DB (schema are identical)
Migrate DB to latest version using Doctrine migration
Extract data
Load it in the new DB
WHat do you think of this process?
Do you think it is feasable using Doctrine?
I tried a few searches on Google without success.
I am currently reviewed the features of Doctrine_Core class.
Thanks for your help
Yes, it is possible to migrate data from one database to another using Doctrine.
It sounds like you're trying to do a one-time database revision and migration and that your applications are not currently written using Doctrine. In that scenario, database abstraction has little or no benefit, unless you're also rewriting the applications to use it.
If you have no prior experience using Doctrine then I seriously doubt that writing custom migration classes in it will be easier than doing it with whatever database API you are already experienced using. It makes sense to use the migration classes (some times) if you are already using Doctrine for your development. Otherwise it's another layer and API you don't need.
I'm using Doctrine 1.2, which has some nice features for migrations but also a number of bugs and omissions of expected functionality. Reportedly version 2 improves on this but I haven't used it yet.
Related
I have been enjoying working on Laravel for a while now, and am planning to move a fairly large project to Laravel 5.
The new project has fairly large database with numerous tables, and it would take considerable amount of time build migrations, models and controllers individually.
Has anybody worked on this before? What is the best way to go about it?
I have used this great extension to generate migrations as of now - but still for a 200+ tables, it would take quite a long time to do the rest.
Try this one:
https://github.com/reliese/laravel
Reliese Laravel is a collection of Laravel Components which aim is to help the development process of Laravel applications by providing some convenient code-generation capabilities.
How about this: http://packalyst.com/packages/package/ignasbernotas/laravel-model-generator
Model generator Laravel 5 model generator for an existing schema.
It plugs into your existing database and generates model class files
based on the existing tables.
For migrating models and controllers just use artisan commands, you can't get around it any easier than that. For the migrations I can suggest trying to use the following package:
Laravel Database Exporter
It will export your existing DB schemas as Laravel migrations. My suggestion is based on the assumption that you are using MySQL as your RDBMS, because the package I suggested only works with that.
Is the Doctrine Migrations project compatible with Doctrine MongoDB?
It isn't clear to me from searching and looking at the Doctrine Migrations project whether it is compatible with ODM solutions (e.g. MongoDB) as well as ORM solutions.
If it is, can anyone suggest examples or articles on how to use the two together?
If it isn't, are there reasonable alternatives?
Question Background:
I understand, marginally, the different approaches to migrating a document's data from one version of the document to another and the pros and cons of each.
I am leaning towards possibly implementing a hybrid approach of gradual schema changes and migration scripts as suggested here. Leveraging the functionality within Doctrine's MongoDB library written about by Jonathan Wage in his post: Doctrine MongoDB ODM Schema Migrations.
Even with that, I need to find some way of creating a migration script or performing the data migration, and Doctrine Migrations seemed like a good first choice.
As an aside, another user warns against using the approach Jonathan Wage presents above for migrating data and instead running commands (JavaScript?) directly against the database.
Despite doctrine-migrations is not compabible with MongoDB ODM (it only supports DBAL) you can bet for the alternative mongo-based migration components made by 3rd party teams.
It was firstly developed here https://github.com/antimattr/mongodb-migrations
but after it has been abandoned the project continues here https://github.com/doesntmattr/mongodb-migrations
Ufortunately, it isn't compatible with ODM. It supports ORM only.
Is it safe to build a Yii application over a SQL Server database which is being used by another software?
The ideia is to migrate that desktop software for a WebApp but I must let the database structure untouched.
It's a quite complex database and I have very complex SQL Queries as well, so I should avoid DAO and AR. I've been looking for some information around the web but it's not clear to me how safe it will be this process. Should I build all the application with RAW SQL and be careful with it's implementation?
Can anyone of you show me the right path I should follow?
Thanks in advance
It is absolutely safe to do this, with Yii you can use any database structure you need. You'll only need to create your models based on your current database structure.
Here a quick guide to use Yii with SQLServer http://www.yiiframework.com/wiki/192/config-use-ms-sql-server-2005-2008/
You can use just plain SQL with Yii, have a look at http://www.yiiframework.com/doc/api/1.1/CDbCommand
But if you want more flexibility, I can recommend you the following way.
create an initial database migration, just execute() a plain SQL dump from your exisiting database.
create database migrations as you need them
apply migrations
develop
go to step 1. if you want to test with newer data and reapply migrations to your database
shut down old application
As your migrations are versioned with your application, you could eg. maintain a branch with the old db-schema and work parallel on an updated version with another db-schema.
I am starting a new (and first) project with Symfony2, but I didn't choise Database engine yet. And it could be MySQL or NoSQL engines like MongoDB or others, or also it could be changed along the proyect cycle.
So, I would like to start working without limitation of choising Doctrine, Doctrine for Mongo or others. And allowing posibility of changing only model layer without big impact on controllers, and classes.
Recomendations? Comments? Best Practices?
Hope this tutorial will help you to get some knowledge. However try to learn the main concepts before doing any major development.
I'm looking for a good php framework with support for handling database migrations. Ideally I would like to be able to run a command that generates a migration script, one that updates the database with changes and can handle rolling back those changes. Is there anything out there that does this?
The Doctrine project supports migrations - http://www.doctrine-project.org/projects/migrations/2.0/docs/reference/introduction/en
Hmm, that documentation is a bit lacking, at least in the introduction. Hopefully it gets better as it goes on.
Whilst most popular in Symfony, this can easily be integrated into other frameworks or even used on its own.
Promising, but not yet have a stable version : https://github.com/fuel/fuel
There is a new php framework called Laravel and it has migrations the same way as ruby on rails. It seems so pretty!
You can find it at http://laravel.com/
Migrations Docs
In addition, the framework introduces the idea of bundles, what can give to your project a great modular view.
If you try it, tell us your experience! :)
symfony - http://www.symfony-project.org/
In symfony you can write database schema using ORM like Propel, it is independant from database driver. If you have a database already, you want to migrate to a different db, I think you can dump the db, change the db config, and re-import it to the new db. (though I have not tried it myself.)
There are much php framework over there that can use any database. For example Zend, Ci, Cake and many others. One thing you should do is change database type that's usually stored in configuration file. And then migrate your database manually. No framework that can generate migration script automatically. U can also use ESF for database migration