The bitter-sweet taste of agnostic database schemas
29 comments Latest by Coach Handbags Sat, 14 Aug 2010 07:12:30 GMT
If you know me at all by now… you might know that I am a huge fan of PostgreSQL. Coming to the Rails camp was a bit of an eye-opener./ Working with PostgreSQL used to save me quite a bit of work and let me sleep at night. I have dealt with the problems that many developers face while working with MySQL. Like many of us in the Open Source world, I was exposed to MySQL more often than PostgreSQL. For several years, I convinced myself that MySQL was awesome because it was fast… but speed isn’t always the most important factor in the technology world. Otherwise, we’d all be coding in C. What PostgreSQL provided to me as a developer was better relational integrity. Foo cannot exist unless Bar does, or vice versa. ON DELETE CASCADE was a godsend and saved me quite a bit of work when building an application. Triggers… Procedural Languages… oh so beautiful.
PostgreSQL was (and is) the Open Source database server that both the Enterprise DBA and Developer could agree on.
Enter Ruby on Rails
At first, I just ignored my instincts and jumped in head first. Pluralization? Primary keys named id? Blasphemy! Yet, I moved forward. After a few days of consistently reminding myself of these new-fangled conventions (I even printed out a little cheat sheet and taped it to my monitor)... I was hooked. Rails worked with PostgreSQL. Let me say that again.
RAILS WORKS WITH POSTGRESQL!
Don’t freak out. Yes, the person who started the Rails project is a MySQL fan... but Rails is database agnostic. It’s true.
I wanted to write an entry to clear up a few myths about Rails.
- Table names are not forced
- Primary Key field names are not forced
- Foriegn Key field names are not forced
- Legacy databases can work with Rails
- Active Record (like much of Rails) can be customized for your particular application’s needs
I was, and still am, concerned about trusting Active Record with handling my relational data… because in some cases it wasn’t doing what it should. But, that is being worked on… and because Rails is Open Source, the issue is transparent for us developers to see and help fix.
In the past, you might have found me advocating the addition of business logic in your database server, whenever possible. It is the gate keeper. The key master. It is not meant to be flexible with your data. If business rules are to change, you change them there so that if you have one or more INPUT streams into your database, the data will not get into your server unless your business rules are met. PostgreSQL even provides you with a nice ERROR message, which some other servers do not. If you can control everything through one INPUT stream (Application Database), then putting these constraints solely in your database abstraction layer is a-ok. However, if you are interfacing with your server through a variety of avenues (Integration Database), you probably already know that your system is going to be a pain to maintain in the long run. So, what are you to do?
Handling Legacy systems is going to be a headache, regardless of what you do… but you can’t always rebuild the whole thing and migrate your data. Add that to your Someday-Maybe list.
When you’re adding new pieces to your application, start by using good tools, frameworks, and practices. For example, try your best to follow the Application Database path to pragmatic enlightenment. Begin working on a new layer for your legacy database. Add on web services that use this layer. Refactor your existing applications. Can they use these new services? ReThink everything. That is… if you have the time and resources to do so.
If you are questioning whether or not to put your business logic in your database abstraction layer, stop. Just do it™. But, do it with caution. Test it. Test it well. I’ll admit that I still add some constraints into my database schemas-I am not ready to give up that extra layer of data security. But, that’s just me. :)
PostgreSQL works with Rails!
...and I promise to show you how to do some fun legacy stuff with Rails in my book. :-)
Enjoying the content? Be sure to subscribe to my RSS feed.






Nice post! ed hardy jeans ed hardy bags ed hardy caps ed hardy sunglasses ed hardy sunglass
RAILS WORKS WITH POSTGRESQL??? wow, I have been using it with mysql and It is now I knew that I can use with pgsql as well.. I will test it…..
i’m using mysql for Rails ..but i like to have some experience with Postgre DB Server also .. thanks for giving this useful information
nice one bro. thank you
Wholesale Clothing
i’m using mysql for Rails ..but i like to have some experience with Postgre DB Server also .. thanks for giving this useful information
Wholesale Brand Name Clothing
i’m using mysql for Rails ..but i like to have some experience with Postgre DB Server also .. thanks for giving this useful information
Wholesalers
Thanks for giving this good information .I’ve Bookmarked this page for future reference.
I didn’t know that rails work with postgresol.
RAILS WORKS WITH POSTGRESQL??? wow, I have been using it with mysql and It is now I knew that I can use with pgsql as well.. I will test it…..
thanks for giving this useful information
http://jordanmass.com/nike-jordan-1-c-1.html nike air jordan 1 flight http://jordanmass.com/nike-jordan-9-c-9.html nike air jordan 9 http://jordanmass.com/nike-jordan-11-c-11.html nike air jordan 11
I have the same reaction with face blog. You have just enlightened me with PostgreSQL’s compatibility with Rails. Thanks for the information. I am ready to try PostgreSQL over MySQL.
Filipino culture
It really is good to try new stuff. I am new with the PostgreSQL with Rails biz and I am happy to know that somebody else is thrilled with working with Post instead of My.
essay application
I like how you manage to dispel quite a few Rails myths for me in just one post. This is really important for somebody who is new to Rails like me. Thanks.
no faxing payday loans
ugg tasmina braid chocolate
yui yui ty u
ytu tyty u
Demonstrate a unique new conceptjordan shoesAw1
good idea…...... value city furniture vitamin shoppe Poptropica
Online Shopping, Gifts, Clothes, Computer :- indiashoppingmalls..blogspot is an online shoping poral where you can shop for all type of Computer,electronic gadgets, clothes, fashion accessories,books,shoes and can gets lots of shopping tips.
Find a New Car, Used Car, Used Cars :- If you own a driver’s license, then there is a good chance that you will find yourself doing quite a bit of night driving at some point in your life. For many people who are new to the wonderful world of driving, this most often occurs when you go away to college.
Computer and Software, Computers Point Of Sale Systems and Software :- The present era is the age of wireless gadgets. The days of wired gadgets are now passé. The same can be said about wireless computer headsets. When headsets for computers were first introduced, they were of the wired variety.
Computer and Software, Computers Point Of Sale Systems and Software :- Access the shared data offline allows you to keep using your shared files, folders and software programs when disconnected from the data server. When you reconnect to your data server, all files will be synchronized to the files on the network.
Singapur Tour and Travel, Tour and Travel :- If you need a vacation get away try a park type, mobile home. That is unless you just have to have the extravagant vacation house and the best of everything. The reason for this kind of a home is that you are not, tied down to one location. You can take the travel trailer with you to any location you choose.
Best India Seo Company, Best Seo company in india :- Search Engine Optimization or SEO, is one of the techniques which is used to make your own WebPages more useful and comfortable for your customers by making the WebPages more understandable and transparent to Search Engines. SEO is an economical method which favors your site to get more page views by forming WebPages that rank very high in Search Engine results.
India property, Find a New Home :- Gurgaon, the fastest developing city in Haryana, belongs to Delhi’s NCR region. No other city has been able to showcase such rapid growth and transformation as Gurgaon. In a very short span of time, it has become the IT and BPO capital of India. It is all set to become one of the mega cities of the country.
Star Web World | Search Engine Optimization | Web design | Computer graphics | Computer Softwares | Online Education
Star Web World | Search Engine Optimization | Web design | Computer graphics | Computer Softwares | Online Education
Louis Vuitton Zippy Coin Purse M6015N Louis Vuitton Zippy Coin Purse Louis Vuitton Zippy Coin Purse M6015M Louis Vuitton Zippy Coin Purse Louis Vuitton Zippy Coin Purse M60152 Louis Vuitton Zippy Coin Purse Louis Vuitton Zippy Coin Purse M6015J Louis Vuitton Zippy Coin Purse Louis Vuitton Zippy Coin Purse M6015K Louis Vuitton Zippy Coin Purse Louis Vuitton Zippy Wallet M6007N Louis Vuitton Zippy Wallet Louis Vuitton Zippy Wallet M6007M Louis Vuitton Zippy Wallet Louis Vuitton Zippy Wallet M6007K Louis Vuitton Zippy Wallet Louis Vuitton Zippy Wallet M6007J Louis Vuitton Zippy Wallet Louis Vuitton Zippy Wallet M60072 Louis Vuitton Zippy Wallet Louis Vuitton Zippy Organizer M6385N Louis Vuitton Zippy Organizer Louis Vuitton Zippy Organizer M63852 Louis Vuitton Zippy Organizer Louis Vuitton Zippy Organizer M6385K Louis Vuitton Zippy Organizer Louis Vuitton Zippy Organizer M6385J Louis Vuitton Zippy Organizer Louis Vuitton Joey Wallet M6658N Louis Vuitton Joey Wallet Louis Vuitton Joey Wallet M6658M Louis Vuitton Joey Wallet Louis Vuitton Joey Wallet M6658J Louis Vuitton Joey Wallet Louis Vuitton Joey Wallet M66582 Louis Vuitton Joey Wallet
online shopping 4 u
Abroad travel & hotels
Construction & Reas estate
homeremodelingservice
The contract, Ceglia said in omega men his complaint, also allowed him Vacheron Constantin Malte an additional 1 percent stake chanel replica jewelry in the business for each burberry scarf replica day after Jan. 1, 2004 Michele Deco until the website was completed. Tiffany Jewelry The website thefacebook.com, according to louis vuitton purses fake the lawsuit, was finished on juicy couture charm bracelet Feb. 4, 2004—a replica burberry 34-day span that would entitle tiffany rings Ceglia to another 34 percent Swiss Army Classic Infantry stake in the business, the Girard Perregaux Laureato EVO3 lawsuit said.
900-1800-1900mhz-gray”>E66 2.4 900-1800-1900mhz-gray”>E66 Dual SIM 900-1800-1900mhz-gray”>e66 phone
touch-screen-dual-sim-dual-network-standby-quadband-gsm-cell-phone-w-java-black”>Mphone
touch-screen-dual-sim-dual-network-standby-quadband-gsm-cell-phone-w-wifi+java—black”>Mini i9 touch-screen-dual-sim-dual-network-standby-quadband-gsm-cell-phone-w-wifi+java—black”>mini i9 phone
MP200
TV80
900-1800-1900mhz-whtie”>e66 white
W002 W002 WiFi
I links of london realize my dream I have a store of the ornaments. I sell Links of London sweetie bracelets and Links of London sweetie rings as well as Links of London sweetie earrings. I links of london sale hope the girl wearing it is happy. I can realize the dream. When I links of london jewellery wear it, the boy hurt my heart. I can not forget these and I believe that perhaps he is not on purpose.
greSQL. For several years, I convinced myself that MySQL was awesome be
air jordan retro 2,air jordan retro 2
jordan ajf 20 shoes,jordan ajf 20 shoes
air max 97,air max 97
Air Jordan 2009,Air Jordan 2009
Air Jordan Fusion 4,Air Jordan Fusion 4
Air Jordan Force 13 Fusion,Air Jordan Force 13 Fusion
Air Jordan Q4,Air Jordan Q4
Air Jordan Flight Fusion 45,Air Jordan Flight Fusion 45
Air Jordan Fusion 11,Air Jordan Fusion 11
We are a professional exporter and wholesaler of brand fashion products,Coach Purse 0055 Red Coach Purse 0056 Black Coach Purse 0057 Black And Gray Coach Purse 0058 Black Coach Purse 0059 Brown And Yellow,All products have good quality,fast and safe delivery without shipping fee. Our primary goal is to meet our clients’ requirement and establish mutually pleasant business relationships with you.If you are interested, please do not hesitate to contact us.