这是一个有效且正确的设计,可以每天跟踪用户活动30天吗?
class AddDayNumbersToUserActivitesForTracking< ActiveRecord的::迁移 改变 add_column:user_activities,:day1,:integer add_column:user_activities,:day2,:integer add_column:user_activities,:day3,:integer add_column:user_activities,:day4,:integer add_column:user_activities,:day5,:integer add_column:user_activities,:day6,:integer add_column:user_activities,:day7,:integer add_column:user_activities,:day8,:integer add_column:user_activities,:day9,:integer add_column:user_activities,:day10,:integer add_column:user_activities,:day11,:integer add_column:user_activities,:day12,:integer add_column:user_activities,:day13,:integer add_column:user_activities,:day14,:integer add_column:user_activities,:day15,:integer add_column:user_activities,:day16,:integer add_column:user_activities,:day17,:integer add_column:user_activities,:day18,:integer add_column:user_activities,:day19,:integer add_column:user_activities,:day20,:integer add_column:user_activities,:day21,:integer add_column:user_activities,:day22,:integer add_column:user_activities,:day23,:integer add_column:user_activities,:day24,:integer add_column:user_activities,:day25,:integer add_column:user_activities,:day26,:integer add_column:user_activities,:day27,:integer add_column:user_activities,:day28,:integer add_column:user_activities,:day29,:integer add_column:user_activities,:day30,:integer 结束 端
create_table“user_activities”,force:true do | t | t.integer“user_id” t.integer“challenge_id” t.datetime“start_time” t.datetime“end_time” t.integer“steps_covered” t.string“status” t.integer“day1” t.integer“day2” t.integer“day3” t.integer“day4” t.integer“day5” t.integer“day6” t.integer“day7” t.integer“day8” t.integer“day9” t.integer“day10” t.integer“day11” t.integer“day12” t.integer“day13” t.integer“day14” t.integer“day15” t.integer“day16” t.integer“day17” t.integer“day18” t.integer“day19” t.integer“day20” t.integer“day21” t.integer“day22” t.integer“day23” t.integer“day24” t.integer“day25” t.integer“day26” t.integer“day27” t.integer“day28” t.integer“day29” t.integer“day30” 端
add_index“user_activities”,[“user_id”,“challenge_id”],名称:“index_user_activities_on_user_id_and_challenge_id” 回复
回复为新主题