Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate movies model and add two migrations
- Loading branch information
1 parent
bbc9770
commit d2858a5
Showing
6 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
class Movie < ApplicationRecord | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
class ChangeMovies < ActiveRecord::Migration[6.0] | |||
def change | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
require 'test_helper' | |||
|
|||
class MovieTest < ActiveSupport::TestCase | |||
# test "the truth" do | |||
# assert true | |||
# end | |||
end |