views:

218

answers:

3

I wish to migrate the database of a legacy web app from SQL Server to MySQL. What are the limitations of MySQL that I must look out for ? And what all items would be part of a comprehensive checklist before jumping into actually modifying the code ?

+1  A: 

First thing I would check is the data types - the exact definition of datatypes varies from database to database. I would create a mapping list that tellme what to map each of the datatypes to. That will help in building the new tables. I would also check for data tables or columns that are not being used now. No point in migrating them. Do the same with functions, job, sps, etc. Now is the time to clean out the junk.

How are you accessing the data through sps or dynamic queries from the database? Check each query by running it aganst a new dev database and make sure they still work. Again there are differences between how the two flavors of SQl work. I've not used my sql so I'm not sure what some of the common failure points are. While you are at it you might want to time new queries and see if they can be optimized. Optimization also varies from database to database and while you are at it, there are probably some poorly performing queries right now that you can fix as part of the migration.

User defined functions will need to be looked at as well. Don't forget these if you are doing this.

Don't forget scheduled jobs, these will need to be checkd and recreated in myslq as well.

Are you importing any data ona regular schedule? All imports will have to be rewritten.

Key to everything is to use a test database and test, test, test. Test everything especially quarterly or annual reports or jobs that you might forget.

Another thing you want to do is do everything through scripts that are version controlled. Do not move to production until you can run all the scripts in order on dev with no failures.

HLGEM
Make sure you have all the right drivers to do the data-migration - http://technikhil.wordpress.com/2007/05/13/getting-microsoft-sql-server-and-mysql-to-talk/
Nikhil
A: 

One thing I forgot, make sure the dev database you are running the migration from (the sql server database) is updated from production immediately before each test run. Hate to have something fail on prod because you were testing against outdated records.

HLGEM
If you can't keep your dev and production schema in sync, you have bigger problems :)
MarkR
I wasn't talking about schema but about the actual data. If the deve database has records that aren't current, one record with unusual values in prod that you don't know about can bring the whole thing to a screaming halt at a bad time and place.
HLGEM
A: 

Your client code is almost certain to be the most complex part to modify. Unless your application has a very high quality test suite, you will end up having to do a lot of testing. You can't rely on anything working the same, even things which you might expect to.

Yes, things in the database itself will need to change, but the client code is where the main action is, it will need heaps of work and rigorous testing.

Forget migrating the data, that is the last thing which should be on your mind; the database schema can probably be converted without too much difficulty; other database objects (SPs, views etc) could cause issues, but the client code is where the focus of the problems will be.

Almost every routine which executes a database query will need to be changed, but absolutely all of them will need to be tested. This will be nontrivial.

I am currently looking at migrating our application's main database from MySQL 4.1 to 5, that is much less of a difference, but it will still be a very, very large task.

MarkR