Skip to content

Commit 5b7d7c9

Browse files
committed
Migration: skip document validation on import
1 parent 9908436 commit 5b7d7c9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/migration/run.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cd /var/www/datapass_reborn_$RAILS_ENV/current
88

99
## TODO TO CHANGE
1010
RAILS_ENV=production
11+
SKIP_DOCUMENT_VALIDATION=true
1112
LOCAL=false
1213
## END TODO
1314

@@ -39,7 +40,7 @@ echo ">> Drop local database"
3940
DISABLE_DATABASE_ENVIRONMENT_CHECK=1 sudo --preserve-env=RAILS_ENV,PATH,DISABLE_DATABASE_ENVIRONMENT_CHECK -u datapass_reborn_$RAILS_ENV bundle exec rails db:schema:load
4041

4142
echo ">> Run main import script"
42-
sudo --preserve-env=RAILS_ENV,LOCAL -u datapass_reborn_$RAILS_ENV bundle exec rails runner "MainImport.new.perform"
43+
sudo --preserve-env=RAILS_ENV,LOCAL,SKIP_DOCUMENT_VALIDATION -u datapass_reborn_$RAILS_ENV bundle exec rails runner "MainImport.new.perform"
4344

4445
echo ">> Change authorization request id sequence"
4546
sudo --preserve-env=RAILS_ENV,LOCAL -u datapass_reborn_$RAILS_ENV bundle exec rails runner "ActiveRecord::Base.connection.execute(\"select setval('authorization_requests_id_seq', 87045, true);\")"

app/models/concerns/authorization_core/documents.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def self.documents
1010
def self.add_document(name, validation_options = {})
1111
class_eval do
1212
has_one_attached name
13-
validates name, validation_options
13+
validates name, validation_options unless ENV['SKIP_DOCUMENT_VALIDATION']
1414

1515
documents << name
1616
end

0 commit comments

Comments
 (0)