From 37cff9c4ba7c070ef357dcad27f79e8d29f2515f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=C3=B1or=20Rolando?= Date: Sun, 8 Dec 2013 12:56:04 +0100 Subject: [PATCH] Generate reposts model/table that stores the repost history. --- app/models/repost.rb | 2 ++ db/migrate/20131208115327_create_reposts.rb | 12 ++++++++++++ test/fixtures/reposts.yml | 11 +++++++++++ test/models/repost_test.rb | 7 +++++++ 4 files changed, 32 insertions(+) create mode 100644 app/models/repost.rb create mode 100644 db/migrate/20131208115327_create_reposts.rb create mode 100644 test/fixtures/reposts.yml create mode 100644 test/models/repost_test.rb diff --git a/app/models/repost.rb b/app/models/repost.rb new file mode 100644 index 0000000..4a18f10 --- /dev/null +++ b/app/models/repost.rb @@ -0,0 +1,2 @@ +class Repost < ActiveRecord::Base +end diff --git a/db/migrate/20131208115327_create_reposts.rb b/db/migrate/20131208115327_create_reposts.rb new file mode 100644 index 0000000..4aad648 --- /dev/null +++ b/db/migrate/20131208115327_create_reposts.rb @@ -0,0 +1,12 @@ +class CreateReposts < ActiveRecord::Migration + def change + create_table :reposts do |t| + t.string :mentioned + t.bigint :postid + t.bigint :repostid + + t.timestamps + end + add_index :reposts, :repostid + end +end diff --git a/test/fixtures/reposts.yml b/test/fixtures/reposts.yml new file mode 100644 index 0000000..b3cefdb --- /dev/null +++ b/test/fixtures/reposts.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + mentioned: MyString + postid: + repostid: + +two: + mentioned: MyString + postid: + repostid: diff --git a/test/models/repost_test.rb b/test/models/repost_test.rb new file mode 100644 index 0000000..187d6f9 --- /dev/null +++ b/test/models/repost_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class RepostTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end