add export_template to exports
This commit is contained in:
parent
a12d6b4af0
commit
7661b8b1b2
5 changed files with 20 additions and 0 deletions
|
@ -31,6 +31,7 @@ class Export < ApplicationRecord
|
|||
belongs_to :procedure_presentation, optional: true
|
||||
belongs_to :instructeur, optional: true
|
||||
belongs_to :user_profile, polymorphic: true, optional: true
|
||||
belongs_to :export_template, optional: true
|
||||
|
||||
has_one_attached :file
|
||||
|
||||
|
|
6
db/migrate/20240131094915_add_template_to_exports.rb
Normal file
6
db/migrate/20240131094915_add_template_to_exports.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddTemplateToExports < ActiveRecord::Migration[7.0]
|
||||
disable_ddl_transaction!
|
||||
def change
|
||||
add_reference :exports, :export_template, null: true, index: { algorithm: :concurrently }
|
||||
end
|
||||
end
|
5
db/migrate/20240131095645_add_export_template_fk.rb
Normal file
5
db/migrate/20240131095645_add_export_template_fk.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddExportTemplateFk < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_foreign_key :exports, :export_templates, validate: false
|
||||
end
|
||||
end
|
5
db/migrate/20240131100329_validate_export_template_fk.rb
Normal file
5
db/migrate/20240131100329_validate_export_template_fk.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class ValidateExportTemplateFk < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
validate_foreign_key :exports, :export_templates
|
||||
end
|
||||
end
|
|
@ -606,6 +606,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_17_053843) do
|
|||
create_table "exports", force: :cascade do |t|
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.integer "dossiers_count"
|
||||
t.bigint "export_template_id"
|
||||
t.string "format", null: false
|
||||
t.bigint "instructeur_id"
|
||||
t.string "job_status", default: "pending", null: false
|
||||
|
@ -617,6 +618,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_17_053843) do
|
|||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.bigint "user_profile_id"
|
||||
t.string "user_profile_type"
|
||||
t.index ["export_template_id"], name: "index_exports_on_export_template_id"
|
||||
t.index ["instructeur_id"], name: "index_exports_on_instructeur_id"
|
||||
t.index ["key"], name: "index_exports_on_key"
|
||||
t.index ["procedure_presentation_id"], name: "index_exports_on_procedure_presentation_id"
|
||||
|
@ -1235,6 +1237,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_17_053843) do
|
|||
add_foreign_key "experts_procedures", "experts"
|
||||
add_foreign_key "experts_procedures", "procedures"
|
||||
add_foreign_key "export_templates", "groupe_instructeurs"
|
||||
add_foreign_key "exports", "export_templates"
|
||||
add_foreign_key "exports", "instructeurs"
|
||||
add_foreign_key "france_connect_informations", "users"
|
||||
add_foreign_key "geo_areas", "champs"
|
||||
|
|
Loading…
Reference in a new issue