Creating stable branch
authorNeil Smith <neil.git@njae.me.uk>
Fri, 17 Jul 2009 20:19:55 +0000 (20:19 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Fri, 17 Jul 2009 20:19:55 +0000 (20:19 +0000)
db/migrate/20090717095501_create_feed_items.rb [new file with mode: 0644]
db/migrate/20090717095948_add_test_data.rb [new file with mode: 0644]
db/schema.rb [new file with mode: 0644]

diff --git a/db/migrate/20090717095501_create_feed_items.rb b/db/migrate/20090717095501_create_feed_items.rb
new file mode 100644 (file)
index 0000000..f34966b
--- /dev/null
@@ -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 (file)
index 0000000..ccd7cdd
--- /dev/null
@@ -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 (file)
index 0000000..677f113
--- /dev/null
@@ -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