diff --git a/app/models/movie.rb b/app/models/movie.rb new file mode 100644 index 0000000..dc614df --- /dev/null +++ b/app/models/movie.rb @@ -0,0 +1,2 @@ +class Movie < ApplicationRecord +end diff --git a/db/migrate/20191224161645_create_movies.rb b/db/migrate/20191224161645_create_movies.rb new file mode 100644 index 0000000..640a21c --- /dev/null +++ b/db/migrate/20191224161645_create_movies.rb @@ -0,0 +1,15 @@ +class CreateMovies < ActiveRecord::Migration[6.0] + def up + create_table :movies do |t| + t.column "title", :string, :limit => 150 + t.column "description", :string, :limit => 300 + t.column "rating", :integer, :limit => 5 + t.timestamps + end + end + + def down + drop_table :movies + end + +end \ No newline at end of file diff --git a/db/migrate/20191224205624_change_movies.rb b/db/migrate/20191224205624_change_movies.rb new file mode 100644 index 0000000..ebfb1ba --- /dev/null +++ b/db/migrate/20191224205624_change_movies.rb @@ -0,0 +1,4 @@ +class ChangeMovies < ActiveRecord::Migration[6.0] + def change + end +end diff --git a/db/schema.rb b/db/schema.rb index b10373b..d23b13a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,17 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 0) do +ActiveRecord::Schema.define(version: 2019_12_24_161645) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + create_table "movies", force: :cascade do |t| + t.string "title", limit: 150 + t.string "description", limit: 300 + t.bigint "rating" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + end diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml new file mode 100644 index 0000000..5181636 --- /dev/null +++ b/test/fixtures/movies.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/movie_test.rb b/test/models/movie_test.rb new file mode 100644 index 0000000..22d7084 --- /dev/null +++ b/test/models/movie_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MovieTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end