forked from Fitchburgh/movielens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.rb
82 lines (82 loc) · 1.84 KB
/
schema.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# require_relative 'environment'
# require_relative '../db/migrate/001_create_users'
# require_relative '../db/migrate/002_create_movies'
# require_relative '../db/migrate/003_create_ratings'
# #
# class CreateUsers < ActiveRecord::Migration[5.0]
# def up
# create_table :users do |t|
# t.integer :age
# t.string :gender
# t.string :job
# end
# end
#
# def down
# drop_table :users
# end
# end
#
# #
# class CreateMovies < ActiveRecord::Migration[5.0]
# def up
# create_table :movies do |t|
# t.string :title
# t.string :release_date
# t.string :video_release
# t.string :url
# t.integer :unknown
# t.integer :action
# t.integer :adventure
# t.integer :animation
# t.integer :children
# t.integer :comedy
# t.integer :crime
# t.integer :documentary
# t.integer :drama
# t.integer :fantasy
# t.integer :filmnoir
# t.integer :horror
# t.integer :musical
# t.integer :mystery
# t.integer :romance
# t.integer :scifi
# t.integer :thriller
# t.integer :war
# t.integer :western
# end
# end
#
# def down
# drop_table :movies
# end
# end
#
# #
# class CreateRatings < ActiveRecord::Migration[5.0]
# def up
# create_join_table :users, :movies, table_name: :ratings do |t|
# t.references :user, index: true, foreign_key: true
# t.references :movie, index: true, foreign_key: true
# t.float :rating
# t.string :timestamp
# end
# end
#
# def down
# drop_table :ratings
# end
# end
#
# def main
# action = (ARGV[0] || :up).to_sym
# CreateUsers.migrate(action)
#
# action = (ARGV[1] || :up).to_sym
# CreateMovies.migrate(action)
#
# action = (ARGV[2] || :up).to_sym
# CreateRatings.migrate(action)
# end
#
# main if __FILE__ == $PROGRAM_NAME