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.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/CHANGELOG.md +5 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +39 -0
  7. data/Rakefile +10 -0
  8. data/lib/recommender/recommendation.rb +79 -0
  9. data/lib/recommender/version.rb +5 -0
  10. data/lib/recommender.rb +10 -0
  11. data/sig/recommender.rbs +4 -0
  12. data/spec/factories/albums.rb +23 -0
  13. data/spec/factories/movie_likes.rb +8 -0
  14. data/spec/factories/movies.rb +7 -0
  15. data/spec/factories/users.rb +27 -0
  16. data/spec/recommender/recommendation_spec.rb +99 -0
  17. data/spec/spec_helper.rb +43 -0
  18. data/spec/test_app/Dockerfile +58 -0
  19. data/spec/test_app/Gemfile +41 -0
  20. data/spec/test_app/Gemfile.lock +240 -0
  21. data/spec/test_app/Rakefile +6 -0
  22. data/spec/test_app/app/assets/config/manifest.js +2 -0
  23. data/spec/test_app/app/assets/stylesheets/application.css +15 -0
  24. data/spec/test_app/app/controllers/application_controller.rb +2 -0
  25. data/spec/test_app/app/helpers/application_helper.rb +2 -0
  26. data/spec/test_app/app/jobs/application_job.rb +7 -0
  27. data/spec/test_app/app/models/album.rb +8 -0
  28. data/spec/test_app/app/models/application_record.rb +3 -0
  29. data/spec/test_app/app/models/movie.rb +7 -0
  30. data/spec/test_app/app/models/movie_like.rb +4 -0
  31. data/spec/test_app/app/models/user.rb +10 -0
  32. data/spec/test_app/app/views/layouts/application.html.erb +15 -0
  33. data/spec/test_app/bin/bundle +109 -0
  34. data/spec/test_app/bin/docker-entrypoint +8 -0
  35. data/spec/test_app/bin/rails +4 -0
  36. data/spec/test_app/bin/rake +4 -0
  37. data/spec/test_app/bin/setup +33 -0
  38. data/spec/test_app/config/application.rb +42 -0
  39. data/spec/test_app/config/boot.rb +3 -0
  40. data/spec/test_app/config/credentials.yml.enc +1 -0
  41. data/spec/test_app/config/database.yml +84 -0
  42. data/spec/test_app/config/environment.rb +5 -0
  43. data/spec/test_app/config/environments/development.rb +65 -0
  44. data/spec/test_app/config/environments/production.rb +83 -0
  45. data/spec/test_app/config/environments/test.rb +54 -0
  46. data/spec/test_app/config/initializers/assets.rb +12 -0
  47. data/spec/test_app/config/initializers/content_security_policy.rb +25 -0
  48. data/spec/test_app/config/initializers/filter_parameter_logging.rb +8 -0
  49. data/spec/test_app/config/initializers/inflections.rb +16 -0
  50. data/spec/test_app/config/initializers/permissions_policy.rb +13 -0
  51. data/spec/test_app/config/locales/en.yml +31 -0
  52. data/spec/test_app/config/master.key +1 -0
  53. data/spec/test_app/config/puma.rb +35 -0
  54. data/spec/test_app/config/routes.rb +10 -0
  55. data/spec/test_app/config.ru +6 -0
  56. data/spec/test_app/db/migrate/20240619132144_create_users.rb +9 -0
  57. data/spec/test_app/db/migrate/20240619132155_create_movies.rb +9 -0
  58. data/spec/test_app/db/migrate/20240619190825_create_movie_likes.rb +10 -0
  59. data/spec/test_app/db/migrate/20240620062947_add_unique_index_to_movies.rb +5 -0
  60. data/spec/test_app/db/migrate/20240620063520_change_name_column_null_on_movies.rb +5 -0
  61. data/spec/test_app/db/migrate/20240620063651_change_name_column_null_on_users.rb +5 -0
  62. data/spec/test_app/db/migrate/20240620063952_add_unique_index_to_users.rb +5 -0
  63. data/spec/test_app/db/migrate/20240621102016_create_albums.rb +10 -0
  64. data/spec/test_app/db/migrate/20240621102359_create_join_table_album_user.rb +8 -0
  65. data/spec/test_app/db/migrate/20240621102813_change_column_null_on_albums.rb +5 -0
  66. data/spec/test_app/db/schema.rb +56 -0
  67. data/spec/test_app/db/seeds.rb +9 -0
  68. data/spec/test_app/log/development.log +23616 -0
  69. data/spec/test_app/log/test.log +0 -0
  70. data/spec/test_app/public/404.html +67 -0
  71. data/spec/test_app/public/422.html +67 -0
  72. data/spec/test_app/public/500.html +66 -0
  73. data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
  74. data/spec/test_app/public/apple-touch-icon.png +0 -0
  75. data/spec/test_app/public/favicon.ico +0 -0
  76. data/spec/test_app/public/robots.txt +1 -0
  77. data/spec/test_app/tmp/local_secret.txt +1 -0
  78. data/spec/test_app/tmp/restart.txt +0 -0
  79. 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,6 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative "config/environment"
4
+
5
+ run Rails.application
6
+ Rails.application.load_server
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMovies < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :movies do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMovieLikes < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :movie_likes do |t|
4
+ t.references :user, null: false, foreign_key: true
5
+ t.references :movie, null: false, foreign_key: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class AddUniqueIndexToMovies < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_index :movies, :name, unique: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeNameColumnNullOnMovies < ActiveRecord::Migration[7.1]
2
+ def change
3
+ change_column_null :movies, :name, false
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeNameColumnNullOnUsers < ActiveRecord::Migration[7.1]
2
+ def change
3
+ change_column_null :users, :name, false
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddUniqueIndexToUsers < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_index :users, :name, unique: true
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateAlbums < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :albums do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ add_index :albums, :name, unique: true
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ class CreateJoinTableAlbumUser < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_join_table :albums, :users do |t|
4
+ t.index [:album_id, :user_id], unique: true
5
+ t.index [:user_id, :album_id]
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeColumnNullOnAlbums < ActiveRecord::Migration[7.1]
2
+ def change
3
+ change_column_null :albums, :name, false
4
+ end
5
+ 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