forked from fixin.me/fixin.me
Add Quantities table
This commit is contained in:
parent
d86e38a3ec
commit
141d67ad21
@ -5,7 +5,7 @@ class CreateUnits < ActiveRecord::Migration[7.0]
|
||||
t.string :symbol, null: false, limit: 15
|
||||
t.text :description
|
||||
t.decimal :multiplier, null: false, precision: 30, scale: 15, default: 1.0
|
||||
t.references :base
|
||||
t.references :base, foreign_key: {to_table: :units}
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
13
db/migrate/20250104194343_create_quantities.rb
Normal file
13
db/migrate/20250104194343_create_quantities.rb
Normal file
@ -0,0 +1,13 @@
|
||||
class CreateQuantities < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :quantities do |t|
|
||||
t.references :user, foreign_key: true
|
||||
t.integer :domain
|
||||
t.string :name, null: false, limit: 31
|
||||
t.text :description
|
||||
t.references :parent, foreign_key: {to_table: :quantities}
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
17
db/schema.rb
17
db/schema.rb
@ -10,7 +10,19 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2023_06_02_185352) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2025_01_04_194343) do
|
||||
create_table "quantities", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.integer "domain"
|
||||
t.string "name", limit: 31, null: false
|
||||
t.text "description"
|
||||
t.bigint "parent_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["parent_id"], name: "index_quantities_on_parent_id"
|
||||
t.index ["user_id"], name: "index_quantities_on_user_id"
|
||||
end
|
||||
|
||||
create_table "units", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.string "symbol", limit: 15, null: false
|
||||
@ -42,5 +54,8 @@ ActiveRecord::Schema[7.2].define(version: 2023_06_02_185352) do
|
||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
end
|
||||
|
||||
add_foreign_key "quantities", "quantities", column: "parent_id"
|
||||
add_foreign_key "quantities", "users"
|
||||
add_foreign_key "units", "units", column: "base_id"
|
||||
add_foreign_key "units", "users"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user