mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-02 03:11:24 -05:00
Add creator reference to crop job templates migration
This commit is contained in:
1 parent
bd4a55331e
commit
f2e437dedc
3 files changed
+13
-2
No files matched your search
@@ -15,7 +15,7 @@
|
||||
- CropJobTemplate.statuses.each_key do |status|
|
||||
%li.nav-item
|
||||
= link_to crop_job_option(:status, status), admin_job_templates_path(status:),
|
||||
class: "nav-link #{'active' if @status == status}"
|
||||
class: "nav-link #{'active' if @status == status}"
|
||||
|
||||
- if @templates.empty?
|
||||
%p No job templates here.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Who wrote a crop job template. Templates loaded from the seed files have none.
|
||||
class AddCreatorToCropJobTemplates < ActiveRecord::Migration[8.1]
|
||||
def change
|
||||
add_reference :crop_job_templates, :creator, foreign_key: { to_table: :members }
|
||||
end
|
||||
end
|
||||
+4
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_10_24_031447) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_10_24_100000) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
enable_extension "pg_trgm"
|
||||
@@ -550,6 +550,8 @@ ActiveRecord::Schema[8.1].define(version: 2026_10_24_031447) do
|
||||
t.string "season", default: "any", null: false
|
||||
t.string "status", default: "draft", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "creator_id"
|
||||
t.index ["creator_id"], name: "index_crop_job_templates_on_creator_id"
|
||||
t.index ["crop_id"], name: "index_crop_job_templates_on_crop_id"
|
||||
end
|
||||
|
||||
@@ -1109,6 +1111,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_10_24_031447) do
|
||||
add_foreign_key "crop_dismissals", "members"
|
||||
add_foreign_key "crop_job_steps", "crop_job_templates"
|
||||
add_foreign_key "crop_job_templates", "crops"
|
||||
add_foreign_key "crop_job_templates", "members", column: "creator_id"
|
||||
add_foreign_key "harvests", "plantings"
|
||||
add_foreign_key "job_idea_dismissals", "members"
|
||||
add_foreign_key "jobs", "crop_job_steps", on_delete: :nullify
|
||||
|
||||
Reference in new issue
Block a user