Introduce permanent and customizable procedure url

This commit is contained in:
Guillaume Lazzara 2016-06-24 16:41:44 +02:00
parent b68b62b8f0
commit e5002dbb11
27 changed files with 5164 additions and 49 deletions

View file

@ -0,0 +1,18 @@
class AddProcedurePathMappingTable < ActiveRecord::Migration
class ProcedurePath < ActiveRecord::Base
end
def change
create_table :procedure_paths do |t|
t.string :path, limit: 30, null: true, unique: true, index: true
t.integer :procedure_id, unique: true, null: true
t.integer :administrateur_id, unique: true, null: true
end
add_foreign_key :procedure_paths, :procedures
add_foreign_key :procedure_paths, :administrateurs
Procedure.all.each do |procedure|
ProcedurePath.create(path: "#{procedure.id}", procedure_id: procedure.id, administrateur_id: procedure.administrateur.id)
end
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160622081321) do
ActiveRecord::Schema.define(version: 20160622081322) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -226,6 +226,14 @@ ActiveRecord::Schema.define(version: 20160622081321) do
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
create_table "procedure_paths", force: :cascade do |t|
t.string "path", limit: 30
t.integer "procedure_id"
t.integer "administrateur_id"
end
add_index "procedure_paths", ["path"], name: "index_procedure_paths_on_path", using: :btree
create_table "procedures", force: :cascade do |t|
t.string "libelle"
t.string "description"
@ -304,4 +312,6 @@ ActiveRecord::Schema.define(version: 20160622081321) do
add_foreign_key "cerfas", "dossiers"
add_foreign_key "commentaires", "dossiers"
add_foreign_key "dossiers", "users"
add_foreign_key "procedure_paths", "administrateurs"
add_foreign_key "procedure_paths", "procedures"
end