diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20130225123010_create_accounts.rb | 10 | ||||
-rw-r--r-- | db/migrate/20130226145932_create_users.rb | 13 | ||||
-rw-r--r-- | db/migrate/20130226150329_create_tweets.rb | 13 | ||||
-rw-r--r-- | db/migrate/20130226150829_create_favorites.rb | 8 | ||||
-rw-r--r-- | db/migrate/20130226151042_create_retweets.rb | 8 | ||||
-rw-r--r-- | db/schema.rb | 52 | ||||
-rw-r--r-- | db/seeds.rb | 7 |
7 files changed, 111 insertions, 0 deletions
diff --git a/db/migrate/20130225123010_create_accounts.rb b/db/migrate/20130225123010_create_accounts.rb new file mode 100644 index 0000000..6856539 --- /dev/null +++ b/db/migrate/20130225123010_create_accounts.rb @@ -0,0 +1,10 @@ +class CreateAccounts < ActiveRecord::Migration + def change + create_table :accounts do |t| + t.string :oauth_token + t.string :oauth_token_secret + + t.timestamps + end + end +end diff --git a/db/migrate/20130226145932_create_users.rb b/db/migrate/20130226145932_create_users.rb new file mode 100644 index 0000000..1c863d2 --- /dev/null +++ b/db/migrate/20130226145932_create_users.rb @@ -0,0 +1,13 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :screen_name + t.string :name + t.text :profile_image_url + + t.timestamps + end + + add_index :users, :screen_name + end +end diff --git a/db/migrate/20130226150329_create_tweets.rb b/db/migrate/20130226150329_create_tweets.rb new file mode 100644 index 0000000..393b26e --- /dev/null +++ b/db/migrate/20130226150329_create_tweets.rb @@ -0,0 +1,13 @@ +class CreateTweets < ActiveRecord::Migration + def change + create_table :tweets do |t| + t.text :text + t.text :source + t.references :user, :limit => 8 + t.datetime :tweeted_at + + t.integer :favorites_count + t.integer :retweets_count + end + end +end diff --git a/db/migrate/20130226150829_create_favorites.rb b/db/migrate/20130226150829_create_favorites.rb new file mode 100644 index 0000000..d8b34fb --- /dev/null +++ b/db/migrate/20130226150829_create_favorites.rb @@ -0,0 +1,8 @@ +class CreateFavorites < ActiveRecord::Migration + def change + create_table :favorites do |t| + t.references :tweet, :limit => 8 + t.references :user, :limit => 8 + end + end +end diff --git a/db/migrate/20130226151042_create_retweets.rb b/db/migrate/20130226151042_create_retweets.rb new file mode 100644 index 0000000..a2eb3cf --- /dev/null +++ b/db/migrate/20130226151042_create_retweets.rb @@ -0,0 +1,8 @@ +class CreateRetweets < ActiveRecord::Migration + def change + create_table :retweets do |t| + t.references :tweet, :limit => 8 + t.references :user, :limit => 8 + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..72fb1e1 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,52 @@ +# encoding: UTF-8 +# 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 that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20130226151042) do + + create_table "accounts", force: true do |t| + t.string "oauth_token" + t.string "oauth_token_secret" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "favorites", force: true do |t| + t.integer "tweet_id", limit: 8 + t.integer "user_id", limit: 8 + end + + create_table "retweets", force: true do |t| + t.integer "tweet_id", limit: 8 + t.integer "user_id", limit: 8 + end + + create_table "tweets", force: true do |t| + t.text "text" + t.text "source" + t.integer "user_id", limit: 8 + t.datetime "tweeted_at" + t.integer "favorites_count" + t.integer "retweets_count" + end + + create_table "users", force: true do |t| + t.string "screen_name" + t.string "name" + t.text "profile_image_url" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "users", ["screen_name"], name: "index_users_on_screen_name" + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) |