Skip to content

Commit e012242

Browse files
committed
add a reference from old workshops table to new pd_workshops, so we can track conversion
1 parent a1bf689 commit e012242

File tree

4 files changed

+36
-24
lines changed

4 files changed

+36
-24
lines changed

dashboard/app/models/workshop.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
#
33
# Table name: workshops
44
#
5-
# id :integer not null, primary key
6-
# name :string(255)
7-
# program_type :string(255) not null
8-
# location :string(1000)
9-
# instructions :string(1000)
10-
# created_at :datetime
11-
# updated_at :datetime
12-
# phase :integer
5+
# id :integer not null, primary key
6+
# name :string(255)
7+
# program_type :string(255) not null
8+
# location :string(1000)
9+
# instructions :string(1000)
10+
# created_at :datetime
11+
# updated_at :datetime
12+
# phase :integer
13+
# pd_workshop_id :integer
1314
#
1415
# Indexes
1516
#
16-
# index_workshops_on_name (name)
17-
# index_workshops_on_program_type (program_type)
17+
# index_workshops_on_name (name)
18+
# index_workshops_on_pd_workshop_id (pd_workshop_id)
19+
# index_workshops_on_program_type (program_type)
1820
#
1921

2022
require 'cdo/workshop_constants'

dashboard/app/serializers/workshop_serializer.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
#
33
# Table name: workshops
44
#
5-
# id :integer not null, primary key
6-
# name :string(255)
7-
# program_type :string(255) not null
8-
# location :string(1000)
9-
# instructions :string(1000)
10-
# created_at :datetime
11-
# updated_at :datetime
12-
# phase :integer
5+
# id :integer not null, primary key
6+
# name :string(255)
7+
# program_type :string(255) not null
8+
# location :string(1000)
9+
# instructions :string(1000)
10+
# created_at :datetime
11+
# updated_at :datetime
12+
# phase :integer
13+
# pd_workshop_id :integer
1314
#
1415
# Indexes
1516
#
16-
# index_workshops_on_name (name)
17-
# index_workshops_on_program_type (program_type)
17+
# index_workshops_on_name (name)
18+
# index_workshops_on_pd_workshop_id (pd_workshop_id)
19+
# index_workshops_on_program_type (program_type)
1820
#
1921

2022
class WorkshopSerializer < ActiveModel::Serializer
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddConvertedPdWorkshopToWorkshop < ActiveRecord::Migration[5.0]
2+
def change
3+
add_reference :workshops, :pd_workshop, foreign_key: true
4+
end
5+
end

dashboard/db/schema.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20190111004745) do
13+
ActiveRecord::Schema.define(version: 20190124225754) do
1414

1515
create_table "activities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
1616
t.integer "user_id"
@@ -1632,13 +1632,15 @@
16321632

16331633
create_table "workshops", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
16341634
t.string "name"
1635-
t.string "program_type", null: false
1636-
t.string "location", limit: 1000
1637-
t.string "instructions", limit: 1000
1635+
t.string "program_type", null: false
1636+
t.string "location", limit: 1000
1637+
t.string "instructions", limit: 1000
16381638
t.datetime "created_at"
16391639
t.datetime "updated_at"
16401640
t.integer "phase"
1641+
t.integer "pd_workshop_id"
16411642
t.index ["name"], name: "index_workshops_on_name", using: :btree
1643+
t.index ["pd_workshop_id"], name: "index_workshops_on_pd_workshop_id", using: :btree
16421644
t.index ["program_type"], name: "index_workshops_on_program_type", using: :btree
16431645
end
16441646

@@ -1684,4 +1686,5 @@
16841686
add_foreign_key "survey_results", "users"
16851687
add_foreign_key "user_geos", "users"
16861688
add_foreign_key "user_proficiencies", "users"
1689+
add_foreign_key "workshops", "pd_workshops"
16871690
end

0 commit comments

Comments
 (0)