I have schema like this:
create_table "grades", force: :cascade do |t|
t.integer "cls"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "post_grades", force: :cascade do |t|
t.integer "post_id"
t.integer "grade_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "posts", force: :cascade do |t|
t.integer "user_id", null: false
t.string "title"
t.text "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "user_grades", force: :cascade do |t|
t.integer "user_id"
t.integer "grade_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
In this schema grades, posts and users all are related to each other.
So my first question: Is it correct way of doing this?
Suppose one of user added grade 4 (cls = 4) in his column and another user added same grade. Now I have same value of cls in grade table for two different grade ids.So is there any data redundancy in this schema?