Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add migration to create pd_application_emails table #24949

Merged
merged 1 commit into from Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions dashboard/app/models/pd/application/email.rb
@@ -0,0 +1,22 @@
# == Schema Information
#
# Table name: pd_application_emails
#
# id :integer not null, primary key
# pd_application_id :integer not null
# application_status :string(255) not null
# email_type :string(255) not null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious - what is email_type for? receipt/reminder/etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. It's the name of the email action. These sometimes correspond with status, but other times don't for instance principal_approval

I'm open to ideas for a better name

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that name makes sense, and it will be easy to tell once there are existing rows.

# to :string(255) not null
# created_at :datetime not null
# sent_at :datetime
#
# Indexes
#
# index_pd_application_emails_on_pd_application_id (pd_application_id)
#

module Pd::Application
class Email < ActiveRecord::Base
self.table_name = 'pd_application_emails'
end
end
@@ -0,0 +1,12 @@
class CreatePdApplicationEmails < ActiveRecord::Migration[5.0]
def change
create_table :pd_application_emails do |t|
t.belongs_to :pd_application, null: false, foreign_key: true, index: true, dependent: :destroy
t.string :application_status, null: false
t.string :email_type, null: false
t.string :to, null: false
t.datetime :created_at, null: false
t.datetime :sent_at
end
end
end
13 changes: 12 additions & 1 deletion dashboard/db/schema.rb
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180823163642) do
ActiveRecord::Schema.define(version: 20180919002239) do

create_table "activities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.integer "user_id"
Expand Down Expand Up @@ -572,6 +572,16 @@
t.integer "teacher_application_id"
end

create_table "pd_application_emails", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.integer "pd_application_id", null: false
t.string "application_status", null: false
t.string "email_type", null: false
t.string "to", null: false
t.datetime "created_at", null: false
t.datetime "sent_at"
t.index ["pd_application_id"], name: "index_pd_application_emails_on_pd_application_id", using: :btree
end

create_table "pd_applications", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.integer "user_id"
t.string "type", null: false
Expand Down Expand Up @@ -1621,6 +1631,7 @@
add_foreign_key "ib_school_codes", "schools"
add_foreign_key "level_concept_difficulties", "levels"
add_foreign_key "other_curriculum_offerings", "schools"
add_foreign_key "pd_application_emails", "pd_applications"
add_foreign_key "pd_payment_terms", "regional_partners"
add_foreign_key "pd_regional_partner_cohorts", "pd_workshops", column: "summer_workshop_id"
add_foreign_key "pd_teachercon1819_registrations", "regional_partners"
Expand Down