From 20ee424e7fe667a5d85c14c315de3528261a7609 Mon Sep 17 00:00:00 2001 From: magnolia-fan Date: Wed, 12 Oct 2011 10:44:20 +0400 Subject: [PATCH] Added track files --- Gemfile | 1 + Gemfile.lock | 3 ++- app/models/track_file.rb | 2 ++ .../20111012063952_add_available_flag_to_tracks.rb | 5 +++++ db/migrate/20111012064322_create_track_files.rb | 12 ++++++++++++ db/schema.rb | 12 +++++++++++- test/fixtures/track_files.yml | 13 +++++++++++++ test/unit/track_file_test.rb | 7 +++++++ 8 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 app/models/track_file.rb create mode 100644 db/migrate/20111012063952_add_available_flag_to_tracks.rb create mode 100644 db/migrate/20111012064322_create_track_files.rb create mode 100644 test/fixtures/track_files.yml create mode 100644 test/unit/track_file_test.rb diff --git a/Gemfile b/Gemfile index 10e83c7..3b130c4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source 'http://rubygems.org' +gem 'rack', '1.3.3' gem 'rails', '3.1.0' gem 'unicorn' diff --git a/Gemfile.lock b/Gemfile.lock index 154e32a..e54ae1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,7 +72,7 @@ GEM nokogiri (1.5.0) pg (0.11.0) polyglot (0.3.2) - rack (1.3.4) + rack (1.3.3) rack-cache (1.0.3) rack (>= 0.4) rack-mount (0.8.3) @@ -135,6 +135,7 @@ DEPENDENCIES mysql2 (= 0.3.7) nokogiri pg + rack (= 1.3.3) rails (= 3.1.0) sass therubyracer diff --git a/app/models/track_file.rb b/app/models/track_file.rb new file mode 100644 index 0000000..7082504 --- /dev/null +++ b/app/models/track_file.rb @@ -0,0 +1,2 @@ +class TrackFile < ActiveRecord::Base +end diff --git a/db/migrate/20111012063952_add_available_flag_to_tracks.rb b/db/migrate/20111012063952_add_available_flag_to_tracks.rb new file mode 100644 index 0000000..0f808b1 --- /dev/null +++ b/db/migrate/20111012063952_add_available_flag_to_tracks.rb @@ -0,0 +1,5 @@ +class AddAvailableFlagToTracks < ActiveRecord::Migration + def change + add_column :tracks, :available, :boolean + end +end diff --git a/db/migrate/20111012064322_create_track_files.rb b/db/migrate/20111012064322_create_track_files.rb new file mode 100644 index 0000000..35fe974 --- /dev/null +++ b/db/migrate/20111012064322_create_track_files.rb @@ -0,0 +1,12 @@ +class CreateTrackFiles < ActiveRecord::Migration + def change + create_table :track_files do |t| + t.integer :track_id + t.integer :owner_id + t.integer :audio_id + t.integer :rating + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index df7e079..b670c58 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110926031740) do +ActiveRecord::Schema.define(:version => 20111012064322) do create_table "album_formats", :force => true do |t| t.integer "album_id" @@ -190,6 +190,15 @@ ActiveRecord::Schema.define(:version => 20110926031740) do add_index "track_artists", ["main"], :name => "index_track_artists_on_main" add_index "track_artists", ["track_id"], :name => "index_track_artists_on_track_id" + create_table "track_files", :force => true do |t| + t.integer "track_id" + t.integer "owner_id" + t.integer "audio_id" + t.integer "rating" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "tracks", :force => true do |t| t.string "name" t.integer "album_id" @@ -202,6 +211,7 @@ ActiveRecord::Schema.define(:version => 20110926031740) do t.integer "length" t.string "country" t.string "mbid" + t.boolean "available" end add_index "tracks", ["album_id"], :name => "index_tracks_on_album_id" diff --git a/test/fixtures/track_files.yml b/test/fixtures/track_files.yml new file mode 100644 index 0000000..4904242 --- /dev/null +++ b/test/fixtures/track_files.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html + +one: + track_id: 1 + owner_id: 1 + audio_id: 1 + rating: 1 + +two: + track_id: 1 + owner_id: 1 + audio_id: 1 + rating: 1 diff --git a/test/unit/track_file_test.rb b/test/unit/track_file_test.rb new file mode 100644 index 0000000..5cd48be --- /dev/null +++ b/test/unit/track_file_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TrackFileTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end