forked from fixin.me/fixin.me
Add Units
This commit is contained in:
19
db/migrate/20230602185352_create_units.rb
Normal file
19
db/migrate/20230602185352_create_units.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CreateUnits < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :units do |t|
|
||||
t.references :user, foreign_key: true
|
||||
t.string :symbol
|
||||
t.string :name
|
||||
t.decimal :multiplier, precision: 30, scale: 15
|
||||
|
||||
t.references :base
|
||||
t.integer :lft, null: false
|
||||
t.integer :rgt, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :units, [:user_id, :symbol], unique: true
|
||||
add_index :units, :lft
|
||||
add_index :units, :rgt
|
||||
end
|
||||
end
|
||||
22
db/schema.rb
22
db/schema.rb
@@ -10,7 +10,24 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_03_11_220654) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_06_02_185352) do
|
||||
create_table "units", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.string "symbol"
|
||||
t.string "name"
|
||||
t.decimal "multiplier", precision: 30, scale: 15
|
||||
t.bigint "base_id"
|
||||
t.integer "lft", null: false
|
||||
t.integer "rgt", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["base_id"], name: "index_units_on_base_id"
|
||||
t.index ["lft"], name: "index_units_on_lft"
|
||||
t.index ["rgt"], name: "index_units_on_rgt"
|
||||
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
|
||||
|
||||
create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "email", limit: 64, null: false
|
||||
t.integer "status", default: 0, null: false
|
||||
@@ -23,10 +40,11 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_11_220654) do
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "unconfirmed_email"
|
||||
t.string "unconfirmed_email", limit: 64
|
||||
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||
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
|
||||
|
||||
add_foreign_key "units", "users"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user