Merge pull request #7623 from betagouv/fix-exports

fix exports generation
This commit is contained in:
Paul Chavard 2022-07-26 17:59:15 +02:00 committed by GitHub
commit 772850cc23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 3 deletions

View file

@ -4,7 +4,7 @@
#
# id :bigint not null, primary key
# format :string not null
# job_status :string
# job_status :string default("pending"), not null
# key :text not null
# procedure_presentation_snapshot :jsonb
# statut :string default("tous")

View file

@ -0,0 +1,7 @@
class AddJobStatusToExports < ActiveRecord::Migration[6.1]
def change
safety_assured do
add_column :exports, :job_status, :string, null: false, default: "pending"
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_07_18_093034) do
ActiveRecord::Schema.define(version: 2022_07_26_151017) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
@ -431,7 +431,7 @@ ActiveRecord::Schema.define(version: 2022_07_18_093034) do
create_table "exports", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "format", null: false
t.string "job_status"
t.string "job_status", default: "pending", null: false
t.text "key", null: false
t.bigint "procedure_presentation_id"
t.jsonb "procedure_presentation_snapshot"

View file

@ -0,0 +1,13 @@
namespace :after_party do
desc 'Deployment task: truncate_exports'
task truncate_exports: :environment do
puts "Running deploy task 'truncate_exports'"
Export.in_batches.destroy_all
# Update task as completed. If you remove the line below, the task will
# run with every deploy (or every time you call after_party:run).
AfterParty::TaskRecord
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end