database updated to create domain crendtial references
This commit is contained in:
@@ -53,7 +53,7 @@ FLUSH PRIVILEGES;
|
|||||||
|
|
||||||
* Database initialization
|
* Database initialization
|
||||||
```
|
```
|
||||||
rails db:migrate
|
RAILS_ENV=production rails db:migrate
|
||||||
|
|
||||||
RAILS_ENV=production rails console
|
RAILS_ENV=production rails console
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3,4 +3,8 @@ class User < ApplicationRecord
|
|||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||||
devise :recoverable, :rememberable, :validatable, :lockable, :timeoutable, :trackable, :registerable
|
devise :recoverable, :rememberable, :validatable, :lockable, :timeoutable, :trackable, :registerable
|
||||||
|
|
||||||
|
def role
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
8
db/migrate/20260427123300_create_domains_admins.rb
Normal file
8
db/migrate/20260427123300_create_domains_admins.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class CreateDomainsAdmins < ActiveRecord::Migration[8.1]
|
||||||
|
def change
|
||||||
|
create_table :domains_admins, id: false do |t|
|
||||||
|
t.belongs_to :users
|
||||||
|
t.belongs_to :domains
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddDomainRedToCredentials < ActiveRecord::Migration[8.1]
|
||||||
|
def change
|
||||||
|
add_reference :credentials, :domain, null: false, foreign_key: true
|
||||||
|
end
|
||||||
|
end
|
||||||
13
db/schema.rb
generated
13
db/schema.rb
generated
@@ -10,12 +10,14 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.1].define(version: 2024_05_21_090545) do
|
ActiveRecord::Schema[8.1].define(version: 2026_04_30_151640) do
|
||||||
create_table "credentials", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
create_table "credentials", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
t.bigint "domain_id", null: false
|
||||||
t.string "email"
|
t.string "email"
|
||||||
t.string "password"
|
t.string "password"
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["domain_id"], name: "index_credentials_on_domain_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "domains", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
create_table "domains", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
@@ -24,6 +26,13 @@ ActiveRecord::Schema[8.1].define(version: 2024_05_21_090545) do
|
|||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "domains_admins", id: false, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
|
t.bigint "domains_id"
|
||||||
|
t.bigint "users_id"
|
||||||
|
t.index ["domains_id"], name: "index_domains_admins_on_domains_id"
|
||||||
|
t.index ["users_id"], name: "index_domains_admins_on_users_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "users", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
create_table "users", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
t.integer "consumed_timestep"
|
t.integer "consumed_timestep"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
@@ -55,4 +64,6 @@ ActiveRecord::Schema[8.1].define(version: 2024_05_21_090545) do
|
|||||||
t.string "email"
|
t.string "email"
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_foreign_key "credentials", "domains"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user