Read my latest article: 8 things I look for in a Ruby on Rails app (posted Thu, 06 Jul 2017 16:59:00 GMT)

One of those mornings

Posted by Tue, 17 Apr 2007 15:09:00 GMT

Well, I made it about eight months since I got my new hard drive... and today… I had to run…

sudo port -v install mysql5 +server

Why? I have to migrate some data from MySQL to PostgreSQL.

Just the beginning...

Posted by Mon, 13 Feb 2006 21:21:00 GMT

3 comments Latest by Brad Tue, 14 Feb 2006 14:02:54 GMT

This week… PLANET ARGON will be making a series of announcements. The last time that we did this we found ourselves with a few new employees. What will be happening this week?

...the rumors in #caboose... are likely to be true.

In other news… Jeremy had to install MySQL on his PowerBook last week...

...the things you do for clients. ;-)

Have a great week!

(more) Migrating from MySQL to PostgreSQL

Posted by Fri, 02 Dec 2005 01:59:00 GMT

Christopher Kings-Lynne is getting ready to release 1.0 of his cool project on PgFoundry called, MySQL Compatibility Functions.

What does this provide?

“A reimplemenation of as many MySQL functions as possible in PostgreSQL, as an aid to porting.”

Basically… a bunch of pg/sql functions… to account for all those mysql functions that you all love so much. :-)

For those who feel like they are stuck with MySQL… check this out.

...it’s not too late!

Next Week… I’ll discuss my progress with PostGIS and Ruby on Rails.

Interviewed by CRN regarding Oracle, MySQL, and PostgreSQL

Posted by Sun, 13 Nov 2005 02:49:00 GMT

I was interviewed by CRN regarding my personal thoughts on how the release of Oracle Express might compete with MySQL and PostgreSQL.

Read the short article…

Oracle Express… {yawn}

Migrating from MySQL to PostgreSQL in 60 seconds (with Rails)

Posted by Sat, 29 Oct 2005 18:23:00 GMT

I do quite a few MySQL to PostgreSQL migrations for clients of PLANET ARGON and over the years I have gone through different methods of handling this procedure. Typically, it involved exporting data, re-importing it through some shell script that does its best to take into consideration the slight differences between the two databases.

While working on a recent project that was to be migrated from MySQL to PostgreSQL, but after some Refactoring had been done to the code base. I had been meaning to spend a few hours coming up with some simplified process of taking data from MySQL and replicating it to a new PostgreSQL database, while maintaining referential integrity.

My original idea was to build a script that referenced two seperate databases and then copied data out and inserted it into the new db after performing a few data changes. This seemed like too much work and I knew that I should be able to harness the power of Ruby and Rails in my process. My next thought? RailsFS.

In a perfect world, I would mount one instance of the application with a mysql database and another with a postgresql database… and just copy the yaml files to the postgresql and bam, it’d work, right? Well, it doesn’t quite work that way. So, I ruled out that idea.

Then I had another idea. I would build a task in my Rakefile that… imported each of those YAML files into PostgreSQL!

We can now type in the following commands:

This first creates my PostgreSQL database tables using Migrations.
rake migrate VERSION=1

then…

rake mysql2pgsql
mysql2pgsql runs…and approx 60 seconds later, I had an exact copy of the MySQL database in PostgreSQL. But wait! PostgreSQL has SEQUENCES… so I then run:
rake migrate VERSION=2

...and my SEQUENCES are ALTER’d.

Yes, I will post some code in the near future. But all I am doing is basically running through all the YAML files that are available from RailsFS and adding them into the new database. It automatically figures out the model name…and is fairly generic at the moment. However, I’d like to spend a bit more time stress-testing it before I post it. :-)

I want to try to work on a RailsFS-less version as well so that I can run this on my PowerBook.

Until next time… have fun!

Older posts: 1 2