diff --git a/db/schema.rb b/db/schema.rb index 84c013b28..010a63503 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_10_31_011638) do +ActiveRecord::Schema[7.2].define(version: 2024_11_30_191031) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -32,7 +32,7 @@ t.text "metadata" t.string "service_name", null: false t.bigint "byte_size", null: false - t.string "checksum" + t.string "checksum", null: false t.datetime "created_at", precision: nil, null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end @@ -44,15 +44,12 @@ end create_table "calculators", force: :cascade do |t| - t.uuid "uuid", default: -> { "gen_random_uuid()" }, null: false - t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "slug" - t.boolean "preferable", default: false - t.index ["name"], name: "index_calculators_on_name", unique: true + t.string "uk_name", default: "", null: false + t.string "en_name", default: "", null: false t.index ["slug"], name: "index_calculators_on_slug", unique: true - t.index ["uuid"], name: "index_calculators_on_uuid", unique: true end create_table "categories", force: :cascade do |t| @@ -60,10 +57,13 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "priority", default: 0, null: false - t.boolean "preferable", default: false, null: false t.string "en_name" - t.index "lower((en_name)::text)", name: "index_categories_on_en_name", unique: true - t.index "lower((uk_name)::text)", name: "index_categories_on_uk_name", unique: true + t.decimal "price", precision: 10, scale: 2, default: "0.0", null: false + t.bigint "field_id" + t.boolean "preferable", default: false, null: false + t.index ["en_name"], name: "index_categories_on_en_name", unique: true + t.index ["field_id"], name: "index_categories_on_field_id" + t.index ["uk_name"], name: "index_categories_on_uk_name", unique: true end create_table "category_categoryables", force: :cascade do |t| @@ -97,21 +97,15 @@ end create_table "fields", force: :cascade do |t| - t.uuid "uuid", default: -> { "gen_random_uuid()" }, null: false - t.bigint "calculator_id", null: false - t.string "selector", null: false - t.string "type", null: false - t.string "label" - t.string "name" - t.string "value" - t.integer "from" - t.integer "to" - t.integer "kind", null: false + t.string "kind", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "unit", default: 0 + t.string "uk_label", default: "", null: false + t.string "en_label", default: "", null: false + t.string "var_name", default: "", null: false + t.bigint "calculator_id", null: false t.index ["calculator_id"], name: "index_fields_on_calculator_id" - t.index ["uuid"], name: "index_fields_on_uuid", unique: true end create_table "flipper_features", force: :cascade do |t| @@ -132,6 +126,19 @@ t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true end + create_table "formulas", force: :cascade do |t| + t.string "expression", default: "", null: false + t.string "uk_label", default: "", null: false + t.string "en_label", default: "", null: false + t.string "uk_unit" + t.string "en_unit" + t.bigint "calculator_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "priority", default: 0, null: false + t.index ["calculator_id"], name: "index_formulas_on_calculator_id" + end + create_table "messages", force: :cascade do |t| t.string "title", null: false t.string "message", null: false @@ -201,9 +208,9 @@ t.string "last_sign_in_ip" t.string "provider" t.string "uid" - t.boolean "blocked", default: false + t.boolean "blocked", default: false, null: false t.integer "role", default: 0 - t.boolean "receive_recomendations", default: false + t.boolean "receive_recomendations", default: false, null: false t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end @@ -222,6 +229,9 @@ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" + add_foreign_key "categories", "fields" add_foreign_key "category_categoryables", "categories" add_foreign_key "diapers_periods", "categories" + add_foreign_key "fields", "calculators" + add_foreign_key "formulas", "calculators" end