recommender 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/lib/recommender/recommendation.rb +79 -0
- data/lib/recommender/version.rb +5 -0
- data/lib/recommender.rb +10 -0
- data/sig/recommender.rbs +4 -0
- data/spec/factories/albums.rb +23 -0
- data/spec/factories/movie_likes.rb +8 -0
- data/spec/factories/movies.rb +7 -0
- data/spec/factories/users.rb +27 -0
- data/spec/recommender/recommendation_spec.rb +99 -0
- data/spec/spec_helper.rb +43 -0
- data/spec/test_app/Dockerfile +58 -0
- data/spec/test_app/Gemfile +41 -0
- data/spec/test_app/Gemfile.lock +240 -0
- data/spec/test_app/Rakefile +6 -0
- data/spec/test_app/app/assets/config/manifest.js +2 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/controllers/application_controller.rb +2 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/jobs/application_job.rb +7 -0
- data/spec/test_app/app/models/album.rb +8 -0
- data/spec/test_app/app/models/application_record.rb +3 -0
- data/spec/test_app/app/models/movie.rb +7 -0
- data/spec/test_app/app/models/movie_like.rb +4 -0
- data/spec/test_app/app/models/user.rb +10 -0
- data/spec/test_app/app/views/layouts/application.html.erb +15 -0
- data/spec/test_app/bin/bundle +109 -0
- data/spec/test_app/bin/docker-entrypoint +8 -0
- data/spec/test_app/bin/rails +4 -0
- data/spec/test_app/bin/rake +4 -0
- data/spec/test_app/bin/setup +33 -0
- data/spec/test_app/config/application.rb +42 -0
- data/spec/test_app/config/boot.rb +3 -0
- data/spec/test_app/config/credentials.yml.enc +1 -0
- data/spec/test_app/config/database.yml +84 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +65 -0
- data/spec/test_app/config/environments/production.rb +83 -0
- data/spec/test_app/config/environments/test.rb +54 -0
- data/spec/test_app/config/initializers/assets.rb +12 -0
- data/spec/test_app/config/initializers/content_security_policy.rb +25 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +8 -0
- data/spec/test_app/config/initializers/inflections.rb +16 -0
- data/spec/test_app/config/initializers/permissions_policy.rb +13 -0
- data/spec/test_app/config/locales/en.yml +31 -0
- data/spec/test_app/config/master.key +1 -0
- data/spec/test_app/config/puma.rb +35 -0
- data/spec/test_app/config/routes.rb +10 -0
- data/spec/test_app/config.ru +6 -0
- data/spec/test_app/db/migrate/20240619132144_create_users.rb +9 -0
- data/spec/test_app/db/migrate/20240619132155_create_movies.rb +9 -0
- data/spec/test_app/db/migrate/20240619190825_create_movie_likes.rb +10 -0
- data/spec/test_app/db/migrate/20240620062947_add_unique_index_to_movies.rb +5 -0
- data/spec/test_app/db/migrate/20240620063520_change_name_column_null_on_movies.rb +5 -0
- data/spec/test_app/db/migrate/20240620063651_change_name_column_null_on_users.rb +5 -0
- data/spec/test_app/db/migrate/20240620063952_add_unique_index_to_users.rb +5 -0
- data/spec/test_app/db/migrate/20240621102016_create_albums.rb +10 -0
- data/spec/test_app/db/migrate/20240621102359_create_join_table_album_user.rb +8 -0
- data/spec/test_app/db/migrate/20240621102813_change_column_null_on_albums.rb +5 -0
- data/spec/test_app/db/schema.rb +56 -0
- data/spec/test_app/db/seeds.rb +9 -0
- data/spec/test_app/log/development.log +23616 -0
- data/spec/test_app/log/test.log +0 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/test_app/public/apple-touch-icon.png +0 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/public/robots.txt +1 -0
- data/spec/test_app/tmp/local_secret.txt +1 -0
- data/spec/test_app/tmp/restart.txt +0 -0
- metadata +304 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# In the development environment your application's code is reloaded any time
|
7
|
+
# it changes. This slows down response time but is perfect for development
|
8
|
+
# since you don't have to restart the web server when you make code changes.
|
9
|
+
config.enable_reloading = true
|
10
|
+
|
11
|
+
# Do not eager load code on boot.
|
12
|
+
config.eager_load = false
|
13
|
+
|
14
|
+
# Show full error reports.
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
|
17
|
+
# Enable server timing
|
18
|
+
config.server_timing = true
|
19
|
+
|
20
|
+
# Enable/disable caching. By default caching is disabled.
|
21
|
+
# Run rails dev:cache to toggle caching.
|
22
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
23
|
+
config.action_controller.perform_caching = true
|
24
|
+
config.action_controller.enable_fragment_cache_logging = true
|
25
|
+
|
26
|
+
config.cache_store = :memory_store
|
27
|
+
config.public_file_server.headers = {
|
28
|
+
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
29
|
+
}
|
30
|
+
else
|
31
|
+
config.action_controller.perform_caching = false
|
32
|
+
|
33
|
+
config.cache_store = :null_store
|
34
|
+
end
|
35
|
+
|
36
|
+
# Print deprecation notices to the Rails logger.
|
37
|
+
config.active_support.deprecation = :log
|
38
|
+
|
39
|
+
# Raise exceptions for disallowed deprecations.
|
40
|
+
config.active_support.disallowed_deprecation = :raise
|
41
|
+
|
42
|
+
# Tell Active Support which deprecation messages to disallow.
|
43
|
+
config.active_support.disallowed_deprecation_warnings = []
|
44
|
+
|
45
|
+
# Raise an error on page load if there are pending migrations.
|
46
|
+
config.active_record.migration_error = :page_load
|
47
|
+
|
48
|
+
# Highlight code that triggered database queries in logs.
|
49
|
+
config.active_record.verbose_query_logs = true
|
50
|
+
|
51
|
+
# Highlight code that enqueued background job in logs.
|
52
|
+
config.active_job.verbose_enqueue_logs = true
|
53
|
+
|
54
|
+
# Suppress logger output for asset requests.
|
55
|
+
# config.assets.quiet = true
|
56
|
+
|
57
|
+
# Raises error for missing translations.
|
58
|
+
# config.i18n.raise_on_missing_translations = true
|
59
|
+
|
60
|
+
# Annotate rendered view with file names.
|
61
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
62
|
+
|
63
|
+
# Raise error when a before_action's only/except options reference missing actions
|
64
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
65
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# Code is not reloaded between requests.
|
7
|
+
config.enable_reloading = false
|
8
|
+
|
9
|
+
# Eager load code on boot. This eager loads most of Rails and
|
10
|
+
# your application in memory, allowing both threaded web servers
|
11
|
+
# and those relying on copy on write to perform better.
|
12
|
+
# Rake tasks automatically ignore this option for performance.
|
13
|
+
config.eager_load = true
|
14
|
+
|
15
|
+
# Full error reports are disabled and caching is turned on.
|
16
|
+
config.consider_all_requests_local = false
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
|
19
|
+
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
20
|
+
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
21
|
+
# config.require_master_key = true
|
22
|
+
|
23
|
+
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
24
|
+
# config.public_file_server.enabled = false
|
25
|
+
|
26
|
+
# Compress CSS using a preprocessor.
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fall back to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
33
|
+
# config.asset_host = "http://assets.example.com"
|
34
|
+
|
35
|
+
# Specifies the header that your server uses for sending files.
|
36
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
37
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
38
|
+
|
39
|
+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
40
|
+
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
41
|
+
# config.assume_ssl = true
|
42
|
+
|
43
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
44
|
+
config.force_ssl = true
|
45
|
+
|
46
|
+
# Log to STDOUT by default
|
47
|
+
config.logger = ActiveSupport::Logger.new(STDOUT)
|
48
|
+
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
49
|
+
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
50
|
+
|
51
|
+
# Prepend all log lines with the following tags.
|
52
|
+
config.log_tags = [ :request_id ]
|
53
|
+
|
54
|
+
# "info" includes generic and useful information about system operation, but avoids logging too much
|
55
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
56
|
+
# want to log everything, set the level to "debug".
|
57
|
+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
58
|
+
|
59
|
+
# Use a different cache store in production.
|
60
|
+
# config.cache_store = :mem_cache_store
|
61
|
+
|
62
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
63
|
+
# config.active_job.queue_adapter = :resque
|
64
|
+
# config.active_job.queue_name_prefix = "test_app_production"
|
65
|
+
|
66
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
67
|
+
# the I18n.default_locale when a translation cannot be found).
|
68
|
+
config.i18n.fallbacks = true
|
69
|
+
|
70
|
+
# Don't log any deprecations.
|
71
|
+
config.active_support.report_deprecations = false
|
72
|
+
|
73
|
+
# Do not dump schema after migrations.
|
74
|
+
config.active_record.dump_schema_after_migration = false
|
75
|
+
|
76
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
77
|
+
# config.hosts = [
|
78
|
+
# "example.com", # Allow requests from example.com
|
79
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
80
|
+
# ]
|
81
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
82
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
83
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
|
8
|
+
Rails.application.configure do
|
9
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
10
|
+
|
11
|
+
# While tests run files are not watched, reloading is not necessary.
|
12
|
+
config.enable_reloading = false
|
13
|
+
|
14
|
+
# Eager loading loads your entire application. When running a single test locally,
|
15
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
16
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
17
|
+
# loading is working properly before deploying your code.
|
18
|
+
config.eager_load = ENV["CI"].present?
|
19
|
+
|
20
|
+
# Configure public file server for tests with Cache-Control for performance.
|
21
|
+
config.public_file_server.enabled = true
|
22
|
+
config.public_file_server.headers = {
|
23
|
+
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
24
|
+
}
|
25
|
+
|
26
|
+
# Show full error reports and disable caching.
|
27
|
+
config.consider_all_requests_local = true
|
28
|
+
config.action_controller.perform_caching = false
|
29
|
+
config.cache_store = :null_store
|
30
|
+
|
31
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
32
|
+
config.action_dispatch.show_exceptions = :rescuable
|
33
|
+
|
34
|
+
# Disable request forgery protection in test environment.
|
35
|
+
config.action_controller.allow_forgery_protection = false
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr.
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
|
40
|
+
# Raise exceptions for disallowed deprecations.
|
41
|
+
config.active_support.disallowed_deprecation = :raise
|
42
|
+
|
43
|
+
# Tell Active Support which deprecation messages to disallow.
|
44
|
+
config.active_support.disallowed_deprecation_warnings = []
|
45
|
+
|
46
|
+
# Raises error for missing translations.
|
47
|
+
# config.i18n.raise_on_missing_translations = true
|
48
|
+
|
49
|
+
# Annotate rendered view with file names.
|
50
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
51
|
+
|
52
|
+
# Raise error when a before_action's only/except options reference missing actions
|
53
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
54
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
# Rails.application.config.assets.version = "1.0"
|
5
|
+
|
6
|
+
# Add additional assets to the asset load path.
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
9
|
+
# Precompile additional assets.
|
10
|
+
# application.js, application.css, and all non-JS/CSS in the app/assets
|
11
|
+
# folder are already added.
|
12
|
+
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Define an application-wide content security policy.
|
4
|
+
# See the Securing Rails Applications Guide for more information:
|
5
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
6
|
+
|
7
|
+
# Rails.application.configure do
|
8
|
+
# config.content_security_policy do |policy|
|
9
|
+
# policy.default_src :self, :https
|
10
|
+
# policy.font_src :self, :https, :data
|
11
|
+
# policy.img_src :self, :https, :data
|
12
|
+
# policy.object_src :none
|
13
|
+
# policy.script_src :self, :https
|
14
|
+
# policy.style_src :self, :https
|
15
|
+
# # Specify URI for violation reports
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
20
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
22
|
+
#
|
23
|
+
# # Report violations without enforcing the policy.
|
24
|
+
# # config.content_security_policy_report_only = true
|
25
|
+
# end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
4
|
+
# Use this to limit dissemination of sensitive information.
|
5
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
6
|
+
Rails.application.config.filter_parameters += [
|
7
|
+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
8
|
+
]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
8
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
9
|
+
# inflect.irregular "person", "people"
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym "RESTful"
|
16
|
+
# end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Define an application-wide HTTP permissions policy. For further
|
4
|
+
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
|
5
|
+
|
6
|
+
# Rails.application.config.permissions_policy do |policy|
|
7
|
+
# policy.camera :none
|
8
|
+
# policy.gyroscope :none
|
9
|
+
# policy.microphone :none
|
10
|
+
# policy.usb :none
|
11
|
+
# policy.fullscreen :self
|
12
|
+
# policy.payment :self, "https://secure.example.com"
|
13
|
+
# end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization and
|
2
|
+
# are automatically loaded by Rails. If you want to use locales other than
|
3
|
+
# English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t "hello"
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t("hello") %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more about the API, please read the Rails Internationalization guide
|
20
|
+
# at https://guides.rubyonrails.org/i18n.html.
|
21
|
+
#
|
22
|
+
# Be aware that YAML interprets the following case-insensitive strings as
|
23
|
+
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
24
|
+
# must be quoted to be interpreted as strings. For example:
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# "yes": yup
|
28
|
+
# enabled: "ON"
|
29
|
+
|
30
|
+
en:
|
31
|
+
hello: "Hello world"
|
@@ -0,0 +1 @@
|
|
1
|
+
3d863297b3a051ce444bd95cc1ccb9c1
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This configuration file will be evaluated by Puma. The top-level methods that
|
2
|
+
# are invoked here are part of Puma's configuration DSL. For more information
|
3
|
+
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
4
|
+
|
5
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
6
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
7
|
+
# Any libraries that use thread pools should be configured to match
|
8
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
9
|
+
# and maximum; this matches the default thread size of Active Record.
|
10
|
+
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
11
|
+
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
12
|
+
threads min_threads_count, max_threads_count
|
13
|
+
|
14
|
+
# Specifies that the worker count should equal the number of processors in production.
|
15
|
+
if ENV["RAILS_ENV"] == "production"
|
16
|
+
require "concurrent-ruby"
|
17
|
+
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
|
18
|
+
workers worker_count if worker_count > 1
|
19
|
+
end
|
20
|
+
|
21
|
+
# Specifies the `worker_timeout` threshold that Puma will use to wait before
|
22
|
+
# terminating a worker in development environments.
|
23
|
+
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
|
24
|
+
|
25
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
26
|
+
port ENV.fetch("PORT") { 3000 }
|
27
|
+
|
28
|
+
# Specifies the `environment` that Puma will run in.
|
29
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
30
|
+
|
31
|
+
# Specifies the `pidfile` that Puma will use.
|
32
|
+
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
33
|
+
|
34
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
35
|
+
plugin :tmp_restart
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
3
|
+
|
4
|
+
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
5
|
+
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
6
|
+
get "up" => "rails/health#show", as: :rails_health_check
|
7
|
+
|
8
|
+
# Defines the root path route ("/")
|
9
|
+
# root "posts#index"
|
10
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema[7.1].define(version: 2024_06_21_102813) do
|
14
|
+
# These are extensions that must be enabled in order to support this database
|
15
|
+
enable_extension "plpgsql"
|
16
|
+
|
17
|
+
create_table "albums", force: :cascade do |t|
|
18
|
+
t.string "name", null: false
|
19
|
+
t.datetime "created_at", null: false
|
20
|
+
t.datetime "updated_at", null: false
|
21
|
+
t.index ["name"], name: "index_albums_on_name", unique: true
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table "albums_users", id: false, force: :cascade do |t|
|
25
|
+
t.bigint "album_id", null: false
|
26
|
+
t.bigint "user_id", null: false
|
27
|
+
t.index ["album_id", "user_id"], name: "index_albums_users_on_album_id_and_user_id", unique: true
|
28
|
+
t.index ["user_id", "album_id"], name: "index_albums_users_on_user_id_and_album_id"
|
29
|
+
end
|
30
|
+
|
31
|
+
create_table "movie_likes", force: :cascade do |t|
|
32
|
+
t.bigint "user_id", null: false
|
33
|
+
t.bigint "movie_id", null: false
|
34
|
+
t.datetime "created_at", null: false
|
35
|
+
t.datetime "updated_at", null: false
|
36
|
+
t.index ["movie_id"], name: "index_movie_likes_on_movie_id"
|
37
|
+
t.index ["user_id"], name: "index_movie_likes_on_user_id"
|
38
|
+
end
|
39
|
+
|
40
|
+
create_table "movies", force: :cascade do |t|
|
41
|
+
t.string "name", null: false
|
42
|
+
t.datetime "created_at", null: false
|
43
|
+
t.datetime "updated_at", null: false
|
44
|
+
t.index ["name"], name: "index_movies_on_name", unique: true
|
45
|
+
end
|
46
|
+
|
47
|
+
create_table "users", force: :cascade do |t|
|
48
|
+
t.string "name", null: false
|
49
|
+
t.datetime "created_at", null: false
|
50
|
+
t.datetime "updated_at", null: false
|
51
|
+
t.index ["name"], name: "index_users_on_name", unique: true
|
52
|
+
end
|
53
|
+
|
54
|
+
add_foreign_key "movie_likes", "movies"
|
55
|
+
add_foreign_key "movie_likes", "users"
|
56
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# This file should ensure the existence of records required to run the application in every environment (production,
|
2
|
+
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
|
3
|
+
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
4
|
+
#
|
5
|
+
# Example:
|
6
|
+
#
|
7
|
+
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
|
8
|
+
# MovieGenre.find_or_create_by!(name: genre_name)
|
9
|
+
# end
|