Added the priciples, sub principles and the groups.

This commit is contained in:
Jez Caudle 2022-06-11 21:13:32 +01:00
parent 0fa0f5f42e
commit dc739cc189
14 changed files with 125 additions and 5 deletions

View File

@ -0,0 +1,3 @@
class Subprinciple < ApplicationRecord
belongs_to :principle
end

View File

@ -0,0 +1,3 @@
class Subprincipleitem < ApplicationRecord
belongs_to :subprincipleitemgroup
end

View File

@ -0,0 +1,3 @@
class Subprincipleitemgroup < ApplicationRecord
belongs_to :subprinciple
end

View File

@ -1,4 +0,0 @@
class Principle < ActiveRecord::Migration[7.0]
def change
end
end

View File

@ -0,0 +1,12 @@
class CreateSubprinciples < ActiveRecord::Migration[7.0]
def change
create_table :subprinciples do |t|
t.references :principle, null: false, foreign_key: true
t.string :name
t.text :description
t.timestamps
end
add_index :subprinciples, :name
end
end

View File

@ -0,0 +1,10 @@
class CreateSubprincipalitemgroups < ActiveRecord::Migration[7.0]
def change
create_table :subprincipleitemgroups do |t|
t.references :subprinciple, null: false, foreign_key: true
t.string :type
t.timestamps
end
end
end

View File

@ -0,0 +1,11 @@
class CreateSubprincipalitems < ActiveRecord::Migration[7.0]
def change
create_table :subprinciplitems do |t|
t.references :subprincipleitemgroup, null: false, foreign_key: true
t.text :description
t.boolean :affirmative
t.timestamps
end
end
end

32
db/schema.rb generated
View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_06_11_183116) do
ActiveRecord::Schema[7.0].define(version: 2022_06_11_194255) do
create_table "action_text_rich_texts", charset: "latin1", force: :cascade do |t|
t.string "name", null: false
t.text "body", size: :long
@ -81,6 +81,33 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_11_183116) do
t.index ["name"], name: "index_principles_on_name"
end
create_table "subprincipleitemgroups", charset: "latin1", force: :cascade do |t|
t.bigint "subprinciple_id", null: false
t.string "type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["subprinciple_id"], name: "index_subprincipleitemgroups_on_subprinciple_id"
end
create_table "subprinciples", charset: "latin1", force: :cascade do |t|
t.bigint "principle_id", null: false
t.string "name"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["name"], name: "index_subprinciples_on_name"
t.index ["principle_id"], name: "index_subprinciples_on_principle_id"
end
create_table "subprinciplitems", charset: "latin1", force: :cascade do |t|
t.bigint "subprincipleitemgroup_id", null: false
t.text "description"
t.boolean "affirmative"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["subprincipleitemgroup_id"], name: "index_subprinciplitems_on_subprincipleitemgroup_id"
end
create_table "users", charset: "latin1", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
@ -107,4 +134,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_11_183116) do
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "cafs", "companies"
add_foreign_key "principles", "cafs"
add_foreign_key "subprincipleitemgroups", "subprinciples"
add_foreign_key "subprinciples", "principles"
add_foreign_key "subprinciplitems", "subprincipleitemgroups"
end

View File

@ -0,0 +1,9 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
subprinciple: one
type:
two:
subprinciple: two
type:

11
test/fixtures/subprincipalitems.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
subprincipleitemgroup: one
description: MyText
affirmative: false
two:
subprincipleitemgroup: two
description: MyText
affirmative: false

11
test/fixtures/subprinciples.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
principle: one
name: MyString
description: MyText
two:
principle: two
name: MyString
description: MyText

View File

@ -0,0 +1,7 @@
require "test_helper"
class SubprincipalitemTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require "test_helper"
class SubprincipalitemgroupTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require "test_helper"
class SubprincipleTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end