From 31e7245157fdab6e6d21e0b74ae9806efdaad53b Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Fri, 17 Jul 2009 20:19:55 +0000 Subject: [PATCH] Creating stable branch --- .../20090717095501_create_feed_items.rb | 19 +++++++++++++++ db/migrate/20090717095948_add_test_data.rb | 16 +++++++++++++ db/schema.rb | 24 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 db/migrate/20090717095501_create_feed_items.rb create mode 100644 db/migrate/20090717095948_add_test_data.rb create mode 100644 db/schema.rb diff --git a/db/migrate/20090717095501_create_feed_items.rb b/db/migrate/20090717095501_create_feed_items.rb new file mode 100644 index 0000000..f34966b --- /dev/null +++ b/db/migrate/20090717095501_create_feed_items.rb @@ -0,0 +1,19 @@ +class CreateFeedItems < ActiveRecord::Migration + def self.up + create_table :feed_items do |t| + t.string :feed_name + t.string :title + t.text :description + + t.timestamps + end + + add_index :feed_items, :feed_name + end + + def self.down + remove_index :feed_items, :feed_name + + drop_table :feed_items + end +end diff --git a/db/migrate/20090717095948_add_test_data.rb b/db/migrate/20090717095948_add_test_data.rb new file mode 100644 index 0000000..ccd7cdd --- /dev/null +++ b/db/migrate/20090717095948_add_test_data.rb @@ -0,0 +1,16 @@ +class AddTestData < ActiveRecord::Migration + def self.up + FeedItem.delete_all + (1..20).each do |item_number| + ('a'..'j').each do |feed_name| + FeedItem.create(:feed_name => "feed-#{feed_name}", + :title => "feed-#{feed_name}-item-" + sprintf("%02d", item_number), + :description => "Feed #{feed_name}, Item #{item_number} has a description") + end + end + end + + def self.down + FeedItem.delete_all + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..677f113 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,24 @@ +# This file is auto-generated from the current state of the database. Instead of editing this file, +# please use the migrations feature of Active Record to incrementally modify your database, and +# then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your database schema. If you need +# to create the application database on another system, you should be using db:schema:load, not running +# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20090717095948) do + + create_table "feed_items", :force => true do |t| + t.string "feed_name" + t.string "title" + t.text "description" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "feed_items", ["feed_name"], :name => "index_feed_items_on_feed_name" + +end -- 2.34.1