Added princples to the data base.
This commit is contained in:
parent
bfae18aae8
commit
0fa0f5f42e
2
Gemfile
2
Gemfile
@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'cancancan'
|
gem 'cancancan'
|
||||||
|
|
||||||
ruby "3.0.3"
|
ruby "3.0.4"
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
||||||
gem "rails", "~> 7.0.2.3"
|
gem "rails", "~> 7.0.2.3"
|
||||||
|
|||||||
3
app/models/principle.rb
Normal file
3
app/models/principle.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class Principle < ApplicationRecord
|
||||||
|
belongs_to :caf
|
||||||
|
end
|
||||||
4
db/migrate/20220611182950_principle.rb
Normal file
4
db/migrate/20220611182950_principle.rb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class Principle < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
end
|
||||||
|
end
|
||||||
12
db/migrate/20220611183116_create_principles.rb
Normal file
12
db/migrate/20220611183116_create_principles.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class CreatePrinciples < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :principles do |t|
|
||||||
|
t.references :caf, null: false, foreign_key: true
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :principles, :name
|
||||||
|
end
|
||||||
|
end
|
||||||
44
db/schema.rb
generated
44
db/schema.rb
generated
@ -10,15 +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.define(version: 2022_02_10_171858) do
|
ActiveRecord::Schema[7.0].define(version: 2022_06_11_183116) do
|
||||||
|
|
||||||
create_table "action_text_rich_texts", charset: "latin1", force: :cascade do |t|
|
create_table "action_text_rich_texts", charset: "latin1", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.text "body", size: :long
|
t.text "body", size: :long
|
||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
t.bigint "record_id", null: false
|
t.bigint "record_id", null: false
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
|
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_171858) do
|
|||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
t.bigint "record_id", null: false
|
t.bigint "record_id", null: false
|
||||||
t.bigint "blob_id", null: false
|
t.bigint "blob_id", null: false
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", null: false
|
||||||
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
||||||
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
||||||
end
|
end
|
||||||
@ -40,7 +39,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_171858) do
|
|||||||
t.string "service_name", null: false
|
t.string "service_name", null: false
|
||||||
t.bigint "byte_size", null: false
|
t.bigint "byte_size", null: false
|
||||||
t.string "checksum"
|
t.string "checksum"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", null: false
|
||||||
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,15 +53,15 @@ ActiveRecord::Schema.define(version: 2022_02_10_171858) do
|
|||||||
t.bigint "company_id", null: false
|
t.bigint "company_id", null: false
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["company_id"], name: "index_cafs_on_company_id"
|
t.index ["company_id"], name: "index_cafs_on_company_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "companies", charset: "latin1", force: :cascade do |t|
|
create_table "companies", charset: "latin1", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "companies_users", id: false, charset: "latin1", force: :cascade do |t|
|
create_table "companies_users", id: false, charset: "latin1", force: :cascade do |t|
|
||||||
@ -72,23 +71,33 @@ ActiveRecord::Schema.define(version: 2022_02_10_171858) do
|
|||||||
t.index ["user_id"], name: "index_companies_users_on_user_id"
|
t.index ["user_id"], name: "index_companies_users_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "principles", charset: "latin1", force: :cascade do |t|
|
||||||
|
t.bigint "caf_id", null: false
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["caf_id"], name: "index_principles_on_caf_id"
|
||||||
|
t.index ["name"], name: "index_principles_on_name"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "users", charset: "latin1", force: :cascade do |t|
|
create_table "users", charset: "latin1", force: :cascade do |t|
|
||||||
t.string "email", default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
t.string "encrypted_password", default: "", null: false
|
t.string "encrypted_password", default: "", null: false
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.datetime "reset_password_sent_at", precision: 6
|
t.datetime "reset_password_sent_at"
|
||||||
t.datetime "remember_created_at", precision: 6
|
t.datetime "remember_created_at"
|
||||||
t.integer "sign_in_count", default: 0, null: false
|
t.integer "sign_in_count", default: 0, null: false
|
||||||
t.datetime "current_sign_in_at", precision: 6
|
t.datetime "current_sign_in_at"
|
||||||
t.datetime "last_sign_in_at", precision: 6
|
t.datetime "last_sign_in_at"
|
||||||
t.string "current_sign_in_ip"
|
t.string "current_sign_in_ip"
|
||||||
t.string "last_sign_in_ip"
|
t.string "last_sign_in_ip"
|
||||||
t.integer "failed_attempts", default: 0, null: false
|
t.integer "failed_attempts", default: 0, null: false
|
||||||
t.string "unlock_token"
|
t.string "unlock_token"
|
||||||
t.datetime "locked_at", precision: 6
|
t.datetime "locked_at"
|
||||||
t.integer "role"
|
t.integer "role"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["email"], name: "index_users_on_email", 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
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
||||||
@ -97,4 +106,5 @@ ActiveRecord::Schema.define(version: 2022_02_10_171858) do
|
|||||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
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 "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||||
add_foreign_key "cafs", "companies"
|
add_foreign_key "cafs", "companies"
|
||||||
|
add_foreign_key "principles", "cafs"
|
||||||
end
|
end
|
||||||
|
|||||||
11
test/fixtures/principles.yml
vendored
Normal file
11
test/fixtures/principles.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
caf: one
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
||||||
|
|
||||||
|
two:
|
||||||
|
caf: two
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
||||||
7
test/models/principle_test.rb
Normal file
7
test/models/principle_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class PrincipleTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user