migrations

This commit is contained in:
Nicolas Bally 2016-10-07 13:49:19 +02:00
parent 83039d583f
commit 7935d77684
6 changed files with 75 additions and 1 deletions

View File

@ -91,6 +91,7 @@ CMSnb::Application.routes.draw do
namespace :admin do
resources :contacts
resources :contact_actions
resources :student_groups
resources :note_files
resources :notes

View File

@ -0,0 +1,6 @@
class AddColorToAdmins < ActiveRecord::Migration
def change
add_column :admins, :color, :string
add_column :admins, :contact_role, :boolean
end
end

View File

@ -0,0 +1,7 @@
class AddAdminToContacts < ActiveRecord::Migration
def change
add_column :contacts, :admin_id, :integer
add_column :contacts, :archived, :boolean, :default => false
add_column :contacts, :provenance_id, :integer, :default => 1
end
end

View File

@ -0,0 +1,14 @@
class CreateContactActions < ActiveRecord::Migration
def change
create_table :contact_actions do |t|
t.integer :admin_id
t.datetime :action_at
t.references :contact, index: true
t.string :action_title
t.text :action_message
t.references :contact_action_pattern
t.timestamps
end
end
end

View File

@ -0,0 +1,21 @@
class CreateContactActionPatterns < ActiveRecord::Migration
def change
create_table :contact_action_patterns do |t|
t.string :title
t.text :description
t.timestamps
end
ContactActionPattern.create(:title => "Appel")
ContactActionPattern.create(:title => "1er Contact")
ContactActionPattern.create(:title => "RDV")
ContactActionPattern.create(:title => "Devis")
ContactActionPattern.create(:title => "Autre")
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: 20151101172457) do
ActiveRecord::Schema.define(version: 20161007085559) do
create_table "admins", force: true do |t|
t.string "name"
@ -31,6 +31,8 @@ ActiveRecord::Schema.define(version: 20151101172457) do
t.string "remember_token"
t.datetime "created_at"
t.datetime "updated_at"
t.string "color"
t.boolean "contact_role"
end
create_table "albums", force: true do |t|
@ -145,6 +147,26 @@ ActiveRecord::Schema.define(version: 20151101172457) do
add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id", using: :btree
add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type", length: {"commentable_type"=>191}, using: :btree
create_table "contact_action_patterns", force: true do |t|
t.string "title"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "contact_actions", force: true do |t|
t.integer "admin_id"
t.datetime "action_at"
t.integer "contact_id"
t.string "action_title"
t.text "action_message"
t.integer "contact_action_pattern_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "contact_actions", ["contact_id"], name: "index_contact_actions_on_contact_id", using: :btree
create_table "contacts", force: true do |t|
t.string "name"
t.string "email"
@ -162,6 +184,9 @@ ActiveRecord::Schema.define(version: 20151101172457) do
t.text "notes"
t.string "statut"
t.boolean "readed"
t.integer "admin_id"
t.boolean "archived", default: false
t.integer "provenance_id", default: 1
end
create_table "content_types", force: true do |t|