Posts Tagged ‘github’

Standalone Rails Migrations

One of the most annoying things about deployments are dealing with databases. In the Java world, using Hibernate to generate your schema is pretty common. It works well in development, where you generally re-create and re-seed your database after each model change. However, it can be disastrous when deploying. It felt like each sprint needed a dedicated day for diff-ing the database schemas and figuring out what changed and what needed to be applied. Often, indexes would be forgotten, resulting in un-foreseen slowness.

Ruby on Rails solves that problem with using migrations. Migrations describe how to move from one version of the database to the next. While it’s built into Rails, I came across Standalone-migrations on GitHub. Not surprisingly, it exposes the core functionality of Ruby on Rails migrations, allowing you to embed it in any kind of project. You’ll still need Ruby to run the migrations along with the correct gems for connecting to the database.

Of course, Ruby on Rails migrations have a few downsides. Personally, I believe that the database should be aware of constraints and relationships. This has other practical benefits, such as automatic indexes. By default, Rails Migrations do not support foreign key’s natively. Simon Harris wrote a plugin to automatically associate foreign keys. Way easier than writing SQL.

Getting a rails plugin to work standalone required some munging, so I ham-fisted Standalone Migrations and Foreign Key Migrations together and put the project on GitHub. If this is something you need, clone my fork of Standalone Migrations.

  • Share/Bookmark

ViJedi is in the Cloud

A few months ago the power supply on my server totally tanked. The cost to replace it was somewhere around $99 and some elbow grease, but it got beyond the point where I wanted to maintain my own hardware. This would be the third hardware failure in as many years and I was frustrated.

I still wanted my own server with full access, so I got an account with Linode. Since I found it very difficult to upgrade between major versions of OpenSUSE, I installed Arch Linux based on the recommendation of the guys over at WeTheCitizens.

This blog, my private repositories and some other stuff sit on this server now, but the shared instance wasn’t going to work for photos.  I signed up for a Flickr pro account and started migrating my public code to GitHub.

When I started this site nearly 5 years ago, none of this would have been practical.  The hosting that you got for $20/mo was worthless.  Code and photosharing sites all sucked.  Now I’ve got a set of tools that work really well and I don’t have to maintain any of it.

  • Share/Bookmark
Return top

About

This is my blog about programming. For random stuff, checkout my Twitter or Tumblr