# GH 워크플로에서 테스트 중 이상한 마이그레이션 오류

**URL:** <https://meta.discourse.org/t/strange-migration-error-in-tests-during-gh-workflow/287022>\
**Category:** Development\
**Created:** [11월 29, 2023, 11:18오후 UTC](https://meta.discourse.org/t/strange-migration-error-in-tests-during-gh-workflow/287022 "2023-11-29T23:18:11Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [11월 29, 2023, 11:18오후 UTC](https://meta.discourse.org/t/strange-migration-error-in-tests-during-gh-workflow/287022/1 "2023-11-29T23:18:11Z")

</div>

Topics 테이블과의 외래키 관계를 생성하려고 합니다.

문제는 가장 이상한 이유로 GitHub 워크플로 테스트 환경에서 테스트 중에 실패한다는 것입니다. 수년 전 코어 마이그레이션에서 이미 제거되었는데, 더 이상 존재하지 않는 부모 테이블의 필드에 접근하려고 시도하고 있습니다!

에러는 `PG::UndefinedColumn: ERROR: column topics.off_topic_count does not exist`입니다.

글쎄요, [2018년 코어 마이그레이션에서 제거되었기 때문이죠!](https://github.com/discourse/discourse/blob/e30678ae14a91cf591a383ebccaef958b7a25d7a/db/migrate/20180917024729_remove_superfluous_columns.rb#L21)

이것이 테스트 과정에서 이미 실행되었음을 확인했습니다:

```plaintext
== 20180917024729 RemoveSuperfluousColumns: migrating =========================
== 20180917024729 RemoveSuperfluousColumns: migrated (0.0410s) ================

```

저는 이 오래된 부모 테이블 필드를 명시적으로 참조하고 있지 않습니다 … SQL이 자체적으로 생성되는 것 같습니다 … 하지만 현재 정의에 대해서는 적절하지 않게 말이죠.

```plaintext
== 20231119010101 CreateLocationsTopicTable: migrating ========================rake aborted!

[12035](https://github.com/paviliondev/discourse-locations/actions/runs/7039607316/job/19158951878?pr=103#step:19:12036)StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

[12036](https://github.com/paviliondev/discourse-locations/actions/runs/7039607316/job/19158951878?pr=103#step:19:12037)

[12037](https://github.com/paviliondev/discourse-locations/actions/runs/7039607316/job/19158951878?pr=103#step:19:12038)PG::UndefinedColumn: ERROR: column topics.off_topic_count does not exist

[12038](https://github.com/paviliondev/discourse-locations/actions/runs/7039607316/job/19158951878?pr=103#step:19:12039)LINE 1: ...cs"."deleted_at", "topics"."highest_post_number", "topics"."...

```

테이블 정의는 정말로 단순합니다:

```plaintext
class CreateLocationsTopicTable < ActiveRecord::Migration[7.0]
  def change
    create_table :locations_topic do |t|
      t.references :topic, foreign_key: true
      t.float :latitude, null: false

SNIP

```

더 이상한 부분은 이 마이그레이션이 프로덕션에서는 작동한다는 것입니다!

어떤 통찰도 환영합니다!

---

_[View the full topic](https://meta.discourse.org/t/strange-migration-error-in-tests-during-gh-workflow/287022)._
