database updated to create domain crendtial references

This commit is contained in:
2026-04-30 15:18:51 +00:00
parent 791034f7a4
commit 92ceddc32e
5 changed files with 30 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ FLUSH PRIVILEGES;
* Database initialization
```
rails db:migrate
RAILS_ENV=production rails db:migrate
RAILS_ENV=production rails console
```

View File

@@ -3,4 +3,8 @@ class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :recoverable, :rememberable, :validatable, :lockable, :timeoutable, :trackable, :registerable
def role
end
end

View 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

View File

@@ -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
View File

@@ -10,12 +10,14 @@
#
# 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|
t.datetime "created_at", null: false
t.bigint "domain_id", null: false
t.string "email"
t.string "password"
t.datetime "updated_at", null: false
t.index ["domain_id"], name: "index_credentials_on_domain_id"
end
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
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|
t.integer "consumed_timestep"
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.datetime "updated_at", null: false
end
add_foreign_key "credentials", "domains"
end