forked from fixin.me/fixin.me
Set constraints on Readouts.user_id foreign key
Add Measurements table
This commit is contained in:
@@ -10,7 +10,13 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_01_21_230456) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2025_01_21_230456) do
|
||||
create_table "measurements", force: :cascade do |t|
|
||||
t.datetime "taken_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "quantities", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.string "name", limit: 31, null: false
|
||||
@@ -20,6 +26,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_21_230456) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "depth", default: 0, null: false
|
||||
t.string "pathname", limit: 511, null: false
|
||||
t.index ["id", "user_id"], name: "index_quantities_on_id_and_user_id", unique: true
|
||||
t.index ["parent_id"], name: "index_quantities_on_parent_id"
|
||||
t.index ["user_id", "parent_id", "name"], name: "index_quantities_on_user_id_and_parent_id_and_name", unique: true
|
||||
t.index ["user_id"], name: "index_quantities_on_user_id"
|
||||
@@ -27,13 +34,15 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_21_230456) do
|
||||
|
||||
create_table "readouts", force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.integer "measurement_id"
|
||||
t.integer "quantity_id", null: false
|
||||
t.integer "category", default: 0, null: false
|
||||
t.float "value", limit: 53, null: false
|
||||
t.integer "unit_id"
|
||||
t.integer "unit_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["quantity_id", "created_at"], name: "index_readouts_on_quantity_id_and_created_at", unique: true
|
||||
t.index ["measurement_id", "quantity_id", "category"], name: "index_readouts_on_measurement_id_and_quantity_id_and_category", unique: true
|
||||
t.index ["measurement_id"], name: "index_readouts_on_measurement_id"
|
||||
t.index ["quantity_id"], name: "index_readouts_on_quantity_id"
|
||||
t.index ["unit_id"], name: "index_readouts_on_unit_id"
|
||||
t.index ["user_id"], name: "index_readouts_on_user_id"
|
||||
@@ -48,6 +57,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_21_230456) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["base_id"], name: "index_units_on_base_id"
|
||||
t.index ["id", "user_id"], name: "index_units_on_id_and_user_id", unique: true
|
||||
t.index ["user_id", "symbol"], name: "index_units_on_user_id_and_symbol", unique: true
|
||||
t.index ["user_id"], name: "index_units_on_user_id"
|
||||
end
|
||||
@@ -72,8 +82,11 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_21_230456) do
|
||||
|
||||
add_foreign_key "quantities", "quantities", column: "parent_id", on_delete: :cascade
|
||||
add_foreign_key "quantities", "users", on_delete: :cascade
|
||||
add_foreign_key "readouts", "quantities"
|
||||
add_foreign_key "readouts", "units"
|
||||
add_foreign_key "readouts", "measurements", on_delete: :cascade
|
||||
add_foreign_key "readouts", "quantities", column: ["quantity_id", "user_id"], primary_key: ["id", "user_id"]
|
||||
add_foreign_key "readouts", "quantities", on_delete: :cascade
|
||||
add_foreign_key "readouts", "units", column: ["unit_id", "user_id"], primary_key: ["id", "user_id"]
|
||||
add_foreign_key "readouts", "units", on_delete: :cascade
|
||||
add_foreign_key "readouts", "users", on_delete: :cascade
|
||||
add_foreign_key "units", "units", column: "base_id", on_delete: :cascade
|
||||
add_foreign_key "units", "users", on_delete: :cascade
|
||||
|
||||
Reference in New Issue
Block a user