Skip to content
Permalink
Browse files

Generate movies model and add two migrations

  • Loading branch information
ImsirovicAjdin committed Dec 24, 2019
1 parent bbc9770 commit d2858a516e90ee305b92b6117296b00991fad837
@@ -0,0 +1,2 @@
class Movie < ApplicationRecord
end
@@ -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
@@ -0,0 +1,4 @@
class ChangeMovies < ActiveRecord::Migration[6.0]
def change
end
end
@@ -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
@@ -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
@@ -0,0 +1,7 @@
require 'test_helper'

class MovieTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit d2858a5

Please sign in to comment.
You can’t perform that action at this time.