Commit 107074b2 by Mai Hoang Thai Ha

add option to model

parent aa1b7f6c
class ApplyJob < ApplicationRecord
belongs_to :job
belongs_to :user
has_one_attached :cv
end
class City < ApplicationRecord
has_and_belongs_to_many :jobs
end
class Company < ApplicationRecord
has_many :jobs
end
class FavoriteJob < ApplicationRecord
belongs_to :job
belongs_to :user
end
class HistoryJob < ApplicationRecord
belongs_to :job
belongs_to :user
end
class Industry < ApplicationRecord
has_and_belongs_to_many :jobs
end
class Job < ApplicationRecord
belongs_to :company
has_and_belongs_to_many :industries
has_and_belongs_to_many :cities
has_many :apply_jobs
has_many :history_jobs
has_many :favorite_jobs
end
class User < ApplicationRecord
has_many :apply_jobs
has_many :history_jobs
has_many :favorite_jobs
has_one_attached :cv
end
class CreateCompanies < ActiveRecord::Migration[6.1]
def change
create_table :companies do |t|
t.string :name
t.text :description
t.string :address
t.timestamps
end
end
end
class CreateIndustries < ActiveRecord::Migration[6.1]
def change
create_table :industries do |t|
t.string :name
t.timestamps
end
end
end
class CreateJobs < ActiveRecord::Migration[6.1]
def change
create_table :jobs do |t|
t.string :title
t.string :type
t.string :salary
t.string :experience
t.string :position
t.datetime :expiration_date
t.text :description
t.text :benefit
t.text :requirement
t.text :other_info
t.references :company, null: false, foreign_key: true
t.timestamps
end
end
end
class IndustriesJobs < ActiveRecord::Migration[6.1]
def change
end
end
class CreateCities < ActiveRecord::Migration[6.1]
def change
create_table :cities do |t|
t.string :name
t.integer :region
t.timestamps
end
end
end
class CitiesJobs < ActiveRecord::Migration[6.1]
def change
end
end
class CreateUsers < ActiveRecord::Migration[6.1]
def change
create_table :users do |t|
t.string :name
t.string :email, null: false
t.string :password_digest
t.string :remember_digest
t.boolean :admin, default: false
t.string :activation_digest
t.boolean :activated, default: false
t.datetime :activated_at
t.string :password_reset_digest
t.datetime :password_reset_sent_at
t.timestamps
end
add_index :users, :email, unique: true
add_index :user, :password_reset_digest, unique: true
end
end
class CreateApplyJobs < ActiveRecord::Migration[6.1]
def change
create_table :apply_jobs do |t|
t.references :job, null: false, foreign_key: true
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end
class CreateHistoryJobs < ActiveRecord::Migration[6.1]
def change
create_table :history_jobs do |t|
t.references :job, null: false, foreign_key: true
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end
class CreateFavoriteJobs < ActiveRecord::Migration[6.1]
def change
create_table :favorite_jobs do |t|
t.references :job, null: false, foreign_key: true
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
create_table :active_storage_blobs do |t|
t.string :key, null: false
t.string :filename, null: false
t.string :content_type
t.text :metadata
t.string :service_name, null: false
t.bigint :byte_size, null: false
t.string :checksum, null: false
t.datetime :created_at, null: false
t.index [ :key ], unique: true
end
create_table :active_storage_attachments do |t|
t.string :name, null: false
t.references :record, null: false, polymorphic: true, index: false
t.references :blob, null: false
t.datetime :created_at, null: false
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
end
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_07_06_020939) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.integer "record_id", null: false
t.integer "blob_id", null: false
t.datetime "created_at", null: false
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
end
create_table "active_storage_blobs", force: :cascade do |t|
t.string "key", null: false
t.string "filename", null: false
t.string "content_type"
t.text "metadata"
t.string "service_name", null: false
t.bigint "byte_size", null: false
t.string "checksum", null: false
t.datetime "created_at", null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end
create_table "active_storage_variant_records", force: :cascade do |t|
t.integer "blob_id", null: false
t.string "variation_digest", null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
create_table "apply_jobs", force: :cascade do |t|
t.integer "job_id", null: false
t.integer "user_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["job_id"], name: "index_apply_jobs_on_job_id"
t.index ["user_id"], name: "index_apply_jobs_on_user_id"
end
create_table "cities", force: :cascade do |t|
t.string "name"
t.integer "region"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "companies", force: :cascade do |t|
t.string "name"
t.text "description"
t.string "address"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "favorite_jobs", force: :cascade do |t|
t.integer "job_id", null: false
t.integer "user_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["job_id"], name: "index_favorite_jobs_on_job_id"
t.index ["user_id"], name: "index_favorite_jobs_on_user_id"
end
create_table "history_jobs", force: :cascade do |t|
t.integer "job_id", null: false
t.integer "user_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["job_id"], name: "index_history_jobs_on_job_id"
t.index ["user_id"], name: "index_history_jobs_on_user_id"
end
create_table "industries", force: :cascade do |t|
t.string "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "jobs", force: :cascade do |t|
t.string "title"
t.string "type"
t.string "salary"
t.string "experience"
t.string "position"
t.datetime "expiration_date"
t.text "description"
t.text "benefit"
t.text "requirement"
t.text "other_info"
t.integer "company_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["company_id"], name: "index_jobs_on_company_id"
end
create_table "users", force: :cascade do |t|
t.string "name"
t.string "email"
t.string "password_digest"
t.string "remember_digest"
t.boolean "admin"
t.string "activation_digest"
t.boolean "activated"
t.datetime "activated_at"
t.string "password_reset_digest"
t.datetime "password_reset_sent_at"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
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 "apply_jobs", "jobs"
add_foreign_key "apply_jobs", "users"
add_foreign_key "favorite_jobs", "jobs"
add_foreign_key "favorite_jobs", "users"
add_foreign_key "history_jobs", "jobs"
add_foreign_key "history_jobs", "users"
add_foreign_key "jobs", "companies"
end
commit e9dbb2b3a757649cb3dc72dfcfe693c222e51789 (HEAD -> task/3_create_database_migration, origin/task/3_create_database_migration)
Merge: 5fa5370 762e43d
Author: Thai Ha <hamht@zigexn.vn>
Date: Tue Jul 6 12:24:35 2021 +0700
Merge branch 'task/3_create_database_migration' of gitlab.zigexn.vn:hamht/VenJob into task/3_create_database_migration
commit 5fa53704566e83a3707ea01e34350fe3f9966c2c
Author: Thai Ha <hamht@zigexn.vn>
Date: Tue Jul 6 12:24:21 2021 +0700
add association option to model
commit 762e43db07d795d3c7b9357672e3eb7778917c37
Author: Thai Ha <hamht@zigexn.vn>
Date: Tue Jul 6 11:57:43 2021 +0700
created migration
commit 78e66c7c713a76e96712ea661b09d56422f875cd
Author: Thai Ha <hamht@zigexn.vn>
Date: Tue Jul 6 09:17:19 2021 +0700
created migration
commit aa1b7f6c0c9bf26d4025a4ca67d1712d86036806 (origin/master, master)
Author: Thai Ha <hamht@zigexn.vn>
Date: Tue Jun 29 10:52:16 2021 +0700
add bootstrap
commit 51f556b2a3fffc89235aecc8f241ad68d0776dec
Author: Thai Ha <hamht@zigexn.vn>
Date: Tue Jun 29 10:48:43 2021 +0700
add bootstrap
commit 880daf801159ce7e194597731e7de3d01cd4f1cd
Author: Thai Ha <hamht@zigexn.vn>
Date: Tue Jun 29 09:59:01 2021 +0700
Initial commit
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
job: one
user: one
two:
job: two
user: two
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
region: 1
two:
name: MyString
region: 1
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
description: MyText
address: MyString
two:
name: MyString
description: MyText
address: MyString
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
job: one
user: one
two:
job: two
user: two
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
job: one
user: one
two:
job: two
user: two
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
two:
name: MyString
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
title: MyString
type:
salary: MyString
experience: MyString
position: MyString
expiration_date: 2021-07-06 08:56:33
description: MyText
benefit: MyText
requirement: MyText
other_info: MyText
company: one
two:
title: MyString
type:
salary: MyString
experience: MyString
position: MyString
expiration_date: 2021-07-06 08:56:33
description: MyText
benefit: MyText
requirement: MyText
other_info: MyText
company: two
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
email: MyString
password_digest: MyString
remember_digest: MyString
admin: false
activation_digest: MyString
activated: false
activated_at: 2021-07-06 09:02:56
password_reset_digest: MyString
password_reset_sent_at: 2021-07-06 09:02:56
two:
name: MyString
email: MyString
password_digest: MyString
remember_digest: MyString
admin: false
activation_digest: MyString
activated: false
activated_at: 2021-07-06 09:02:56
password_reset_digest: MyString
password_reset_sent_at: 2021-07-06 09:02:56
require "test_helper"
class ApplyJobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require "test_helper"
class CityTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require "test_helper"
class CompanyTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require "test_helper"
class FavoriteJobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require "test_helper"
class HistoryJobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require "test_helper"
class IndustryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require "test_helper"
class JobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require "test_helper"
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
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