Skip to content

Prefectures #175

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

Merged
merged 6 commits into from
Nov 3, 2017
Merged

Prefectures #175

merged 6 commits into from
Nov 3, 2017

Conversation

nalabjp
Copy link
Member

@nalabjp nalabjp commented Nov 3, 2017

#174

地域(Region)を全国のdojo一覧で使用したいので、都道府県テーブル(prefectures)を追加してDojo belongs_to Prefectureとしました。
ActiveHashを使うという手もあると思うんですが、
後々イベント履歴の統計情報をSQLで抽出することを考えると、
テーブルとして持っておいたほうが良さそうだったのでマスターテーブルにしました。

@yasulab
Copy link
Member

yasulab commented Nov 3, 2017

おー、早速のPRが...!! ありがとうございます😸 LGTM なので、マージしますね! 🔧 💨

@yasulab yasulab merged commit 9848993 into master Nov 3, 2017
@yasulab yasulab deleted the prefectures branch November 3, 2017 05:18
@@ -0,0 +1,5 @@
class AddPrefectureIdToDojo < ActiveRecord::Migration[5.1]
def change
add_column :dojos, :prefecture_id, :integer
Copy link
Member Author

Choose a reason for hiding this comment

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

after: :idとか書きたいところなんですが、postgresqlはサポートしていないので書いていません。(多分、開発時に使っているsqlite3も)
cf: http://wiki.postgresql.org/wiki/Alter_column_position

あと、null: falseも指定したいところなのですが、Rake taskを使った既存レコードのmigrate時に落ちてしまうので、NOT NULL制約も外しました。

@nalabjp
Copy link
Member Author

nalabjp commented Nov 3, 2017

コメントしている間にマージされていた、早い🤣

@yasulab
Copy link
Member

yasulab commented Nov 3, 2017

何か破壊的な変更があったわけではなく、特に気になる点も見当たらなかったので早速マージさせていただきました! 😸

@nalabjp nalabjp mentioned this pull request Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants