Skip to content

Commit

Permalink
Remove unused migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadser committed Jul 16, 2024
1 parent 2c524c0 commit 4d46d46
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 91 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ end

gem 'ruby-openai', '~> 7.0'

gem "devise", "~> 4.9"
gem "devise-jwt", "~> 0.12.0"
gem 'devise', '~> 4.9'
gem 'devise-jwt', '~> 0.12.0'

gem 'solid_queue', '~> 0.3.3'

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ GEM
jbuilder (2.12.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.7.2)
jwt (2.8.2)
base64
json (2.7.2)
language_server-protocol (3.17.0.3)
loofah (2.22.0)
crass (~> 1.0.2)
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception, if: Proc.new { |c| c.request.format != 'application/json' }
protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' }
protect_from_forgery with: :exception, if: proc { |c| c.request.format != 'application/json' }
protect_from_forgery with: :null_session, if: proc { |c| c.request.format == 'application/json' }

before_action :authenticate_user!

Expand Down
21 changes: 19 additions & 2 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth, :params_auth]
config.skip_session_storage = %i[http_auth params_auth]

# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
Expand Down Expand Up @@ -313,6 +313,23 @@

# devise-jwt config
config.jwt do |jwt|
jwt.secret = Rails.application.credentials.devise_jwt_secret_key!
credentials = Rails.application.credentials

unless credentials.devise_jwt_secret_key.present?
encrypted = ActiveSupport::EncryptedConfiguration.new(
config_path: 'config/credentials.yml.enc',
key_path: 'config/master.key',
env_key: 'RAILS_MASTER_KEY',
raise_if_missing_key: true
)

current_credentials = YAML.load(encrypted.read) || {}
devise_jwt_secret_key = SecureRandom.hex(12)
updated_credentials = current_credentials.deep_merge({devise_jwt_secret_key: devise_jwt_secret_key})
encrypted.write(updated_credentials.to_yaml)
jwt.secret = devise_jwt_secret_key
else
jwt.secret = credentials.devise_jwt_secret_key!
end
end
end
11 changes: 0 additions & 11 deletions db/migrate/20240605185921_create_messages.rb

This file was deleted.

7 changes: 0 additions & 7 deletions db/migrate/20240605222045_add_from_to_message.rb

This file was deleted.

11 changes: 0 additions & 11 deletions db/migrate/20240605222936_create_chats.rb

This file was deleted.

13 changes: 0 additions & 13 deletions db/migrate/20240609152859_create_participants.rb

This file was deleted.

7 changes: 0 additions & 7 deletions db/migrate/20240609153938_add_chat_ref_to_messages.rb

This file was deleted.

33 changes: 0 additions & 33 deletions db/migrate/20240715112948_drop_unused_tables.rb

This file was deleted.

2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion rails

This file was deleted.

0 comments on commit 4d46d46

Please sign in to comment.