Notification: add timestamp to champs, pieces jusitificatives and follows

This commit is contained in:
Simon Lehericey 2017-10-23 10:25:07 +02:00 committed by Mathieu Magnin
parent 101ad54be0
commit 909ecf2142
5 changed files with 44 additions and 7 deletions

View file

@ -3,4 +3,15 @@ class Follow < ActiveRecord::Base
belongs_to :dossier belongs_to :dossier
validates_uniqueness_of :gestionnaire_id, :scope => :dossier_id validates_uniqueness_of :gestionnaire_id, :scope => :dossier_id
before_create :set_default_date
private
def set_default_date
self.demande_seen_at = DateTime.now
self.annotations_privees_seen_at = DateTime.now
self.avis_seen_at = DateTime.now
self.messagerie_seen_at = DateTime.now
end
end end

View file

@ -0,0 +1,6 @@
class AddTimeStampToChamps < ActiveRecord::Migration[5.0]
def change
add_column :champs, :created_at, :datetime
add_column :champs, :updated_at, :datetime
end
end

View file

@ -0,0 +1,8 @@
class AddLastViewsAtToFollow < ActiveRecord::Migration[5.0]
def change
add_column :follows, :demande_seen_at, :datetime
add_column :follows, :annotations_privees_seen_at, :datetime
add_column :follows, :avis_seen_at, :datetime
add_column :follows, :messagerie_seen_at, :datetime
end
end

View file

@ -0,0 +1,5 @@
class AddColumnUpdatedAtToPieceJustificative < ActiveRecord::Migration[5.0]
def change
add_column :pieces_justificatives, :updated_at, :datetime
end
end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20171019113610) do ActiveRecord::Schema.define(version: 20171024135653) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -136,10 +136,12 @@ ActiveRecord::Schema.define(version: 20171019113610) do
end end
create_table "champs", force: :cascade do |t| create_table "champs", force: :cascade do |t|
t.string "value" t.string "value"
t.integer "type_de_champ_id" t.integer "type_de_champ_id"
t.integer "dossier_id" t.integer "dossier_id"
t.string "type" t.string "type"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["dossier_id"], name: "index_champs_on_dossier_id", using: :btree t.index ["dossier_id"], name: "index_champs_on_dossier_id", using: :btree
t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id", using: :btree t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id", using: :btree
end end
@ -250,8 +252,12 @@ ActiveRecord::Schema.define(version: 20171019113610) do
end end
create_table "follows", force: :cascade do |t| create_table "follows", force: :cascade do |t|
t.integer "gestionnaire_id", null: false t.integer "gestionnaire_id", null: false
t.integer "dossier_id", null: false t.integer "dossier_id", null: false
t.datetime "demande_seen_at"
t.datetime "annotations_privees_seen_at"
t.datetime "avis_seen_at"
t.datetime "messagerie_seen_at"
t.index ["dossier_id"], name: "index_follows_on_dossier_id", using: :btree t.index ["dossier_id"], name: "index_follows_on_dossier_id", using: :btree
t.index ["gestionnaire_id", "dossier_id"], name: "index_follows_on_gestionnaire_id_and_dossier_id", unique: true, using: :btree t.index ["gestionnaire_id", "dossier_id"], name: "index_follows_on_gestionnaire_id_and_dossier_id", unique: true, using: :btree
t.index ["gestionnaire_id"], name: "index_follows_on_gestionnaire_id", using: :btree t.index ["gestionnaire_id"], name: "index_follows_on_gestionnaire_id", using: :btree
@ -348,6 +354,7 @@ ActiveRecord::Schema.define(version: 20171019113610) do
t.integer "user_id" t.integer "user_id"
t.string "original_filename" t.string "original_filename"
t.string "content_secure_token" t.string "content_secure_token"
t.datetime "updated_at"
t.index ["dossier_id"], name: "index_pieces_justificatives_on_dossier_id", using: :btree t.index ["dossier_id"], name: "index_pieces_justificatives_on_dossier_id", using: :btree
t.index ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree t.index ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
end end