Migration: Index and make Procedure.path nonnull

This commit is contained in:
Nicolas Bouilleaud 2019-09-17 15:55:35 +02:00
parent 703c436c61
commit e9c6ed80e4
4 changed files with 11 additions and 3 deletions

View file

@ -0,0 +1,6 @@
class MakePathNonnull < ActiveRecord::Migration[5.2]
def change
change_column_null :procedures, :path, false
add_index :procedures, [:path, :archived_at, :hidden_at], unique: true
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: 2019_09_17_120856) do
ActiveRecord::Schema.define(version: 2019_09_17_151652) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -480,12 +480,13 @@ ActiveRecord::Schema.define(version: 2019_09_17_120856) do
t.string "cadre_juridique"
t.boolean "juridique_required", default: true
t.boolean "durees_conservation_required", default: true
t.string "path"
t.string "path", null: false
t.string "declarative_with_state"
t.text "monavis_embed"
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id"
t.index ["path", "archived_at", "hidden_at"], name: "index_procedures_on_path_and_archived_at_and_hidden_at", unique: true
t.index ["service_id"], name: "index_procedures_on_service_id"
end