A A

Archive | SQL

Quick BASH Script to Dump & Compress a MySQL Database

Saturday, December 27, 2008

1 Comment

A quick script I whipped up to dump my MySQL database. Usage: sh backthatsqlup.sh (be warned that it dumps ALL databases. This can get huge uncompressed) #!/bin/sh # Isam (Biodegradablegeek.com) public domain 12/28/2008 # Basic BASH script to dump and compress a MySQL dump   out=sequel_`date +'%m%d%Y_%M%S'`.sql dest=/bx/   function e { echo -e "n** $1" }   e "Dumping SQL file ($out). May take awhile..." #echo "oh [...]

How To Use Fixtures to Populate Your Database in Rails

Friday, July 11, 2008

5 Comments

UPDATE: I’ve been using this method for awhile now: http://railspikes.com/2008/2/1/loading-seed-data Seed data is data that the app is dependent on. It is data that has to exist if you were to wipe the database clean and reload your schema. Some examples would be a list of cities/states, a list of categories, or the initial ‘admin’ user [...]

Simple Way to Populate a Database in Rails

Tuesday, March 18, 2008

2 Comments

This is how I populate my database when I have a lot of data but can’t be bothered to write more than a quick throw-away hack. This doesn’t use fixtures, nor migrations (nothing wrong with them, I wuv migrations). Just a ruby file and the Rails console (this is optional actually). I create a new rb [...]

Understanding Basic Database Relationships in Rails

Wednesday, December 26, 2007

17 Comments

This short tutorial will be beneficial for you if database relationships and keywords like belongs_to and has_many confuse you, or if you’re trying to find out how relationships are implemented in Rails. As we create a small demonstration project, you’ll see that one beauty of Rails is how it does most of the work gluing [...]

Using Vim as a Complete Ruby on Rails IDE

Thursday, December 13, 2007

30 Comments

NOTE: If you are experiencing segmentation faults with vim and rails.vim, see this post. When coding in Ruby on Rails, you’ll usually be switching between files and running scripts a lot. It can be time-consuming and frustrating coding Rails using a traditional text editor designed for working on big files individually. Vim lets you hop around [...]