Commit b17ae494 authored by Taico Aerts's avatar Taico Aerts
Browse files

Create company departments

parent cf0f63d8
......@@ -9,6 +9,8 @@ class Company < ApplicationRecord
has_many :role_invitations, as: :resource, dependent: :destroy
has_many :company_departments, dependent: :destroy
enum affiliation: { external: 0, internal: 1 }
# ===========================================================================
......
class CompanyDepartment < ApplicationRecord
ROLES = [:employee].freeze
resourcify
belongs_to :company
end
\ No newline at end of file
class CreateCompanyDepartments < ActiveRecord::Migration[6.1]
def change
create_table :company_departments do |t|
t.references :company, null: false, foreign_key: true
t.string :department
t.timestamps
end
end
end
\ No newline at end of file
......@@ -104,6 +104,14 @@ ActiveRecord::Schema.define(version: 2021_07_20_205752) do
t.index ["original_id"], name: "index_companies_on_original_id", unique: true
end
create_table "company_departments", force: :cascade do |t|
t.integer "company_id", null: false
t.string "department"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["company_id"], name: "index_company_departments_on_company_id"
end
create_table "course_configurations", force: :cascade do |t|
t.integer "min_group_size", default: 1, null: false
t.integer "max_group_size", default: 1, null: false
......@@ -703,6 +711,7 @@ ActiveRecord::Schema.define(version: 2021_07_20_205752) do
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 "company_departments", "companies"
add_foreign_key "theme_associated_users", "themes"
add_foreign_key "theme_associated_users", "users"
add_foreign_key "thesis_project_associated_users", "thesis_projects"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment