Commit 5e004055 by Tô Ngọc Ánh

Merge branch 'migration-db' into 'master'

Migration Database

See merge request !1
parents 137ebf00 178460a2
Pipeline #686 failed with stages
in 0 seconds
class AppliedJob < ApplicationRecord
belongs_to :user
belongs_to :job
end
class Company < ApplicationRecord
has_many :jobs
end
class Favorite < ApplicationRecord
belongs_to :user
belongs_to :job
end
class History < ApplicationRecord
belongs_to :user
belongs_to :job
end
class IndustriesJob < ApplicationRecord
belongs_to :job
belongs_to :industry
end
class Industry < ApplicationRecord
has_and_belongs_to_many :jobs
end
class Job < ApplicationRecord
belongs_to :company
has_many :applied_jobs
has_many :histories
has_many :favorites
has_many :locations, through: :locations_jobs
has_and_belongs_to_many :industries
end
class Location < ApplicationRecord
has_many :jobs, through: :locations_jobs
end
class LocationsJob < ApplicationRecord
belongs_to :job
belongs_to :location
end
class User < ApplicationRecord
has_many :favorites
has_many :histories
has_many :applied_jobs
end
class CreateIndustries < ActiveRecord::Migration[5.2]
def change
create_table :industries do |t|
t.string :name
t.timestamps
end
end
end
class CreateLocations < ActiveRecord::Migration[5.2]
def change
create_table :locations do |t|
t.string :area
t.string :city
t.timestamps
end
end
end
class CreateCompanies < ActiveRecord::Migration[5.2]
def change
create_table :companies do |t|
t.string :name
t.text :description
t.string :address
t.timestamps
end
end
end
class CreateJobs < ActiveRecord::Migration[5.2]
def change
create_table :jobs do |t|
t.references :company, foreign_key: true
t.string :title
t.string :level
t.string :salary
t.string :experience
t.text :description
t.date :expiration_date
t.timestamps
end
end
end
class CreateLocationsJobs < ActiveRecord::Migration[5.2]
def change
create_table :locations_jobs do |t|
t.references :job, foreign_key: true
t.references :location, foreign_key: true
t.timestamps
end
end
end
class CreateIndustriesJobs < ActiveRecord::Migration[5.2]
def change
create_table :industries_jobs, id: false do |t|
t.belongs_to :job, index: true
t.belongs_to :industry, index: true
end
end
end
class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :email
t.string :full_name
t.string :curriculum_vitae
t.string :password
t.boolean :admin
t.timestamps
end
end
end
class CreateHistories < ActiveRecord::Migration[5.2]
def change
create_table :histories do |t|
t.references :user, foreign_key: true
t.references :job, foreign_key: true
t.timestamps
end
end
end
class CreateFavorites < ActiveRecord::Migration[5.2]
def change
create_table :favorites do |t|
t.references :user, foreign_key: true
t.references :job, foreign_key: true
t.timestamps
end
end
end
class CreateAppliedJobs < ActiveRecord::Migration[5.2]
def change
create_table :applied_jobs do |t|
t.references :user, foreign_key: true
t.references :job, foreign_key: true
t.string :full_name
t.string :email
t.string :curriculum_vitae
t.timestamps
end
end
end
......@@ -10,6 +10,105 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 0) do
ActiveRecord::Schema.define(version: 2020_07_17_014308) do
create_table "applied_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "user_id"
t.bigint "job_id"
t.string "full_name"
t.string "email"
t.string "curriculum_vitae"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["job_id"], name: "index_applied_jobs_on_job_id"
t.index ["user_id"], name: "index_applied_jobs_on_user_id"
end
create_table "companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "name"
t.text "description"
t.string "address"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "favorites", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "user_id"
t.bigint "job_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["job_id"], name: "index_favorites_on_job_id"
t.index ["user_id"], name: "index_favorites_on_user_id"
end
create_table "histories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "user_id"
t.bigint "job_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["job_id"], name: "index_histories_on_job_id"
t.index ["user_id"], name: "index_histories_on_user_id"
end
create_table "industries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "industries_jobs", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "job_id"
t.bigint "industry_id"
t.index ["industry_id"], name: "index_industries_jobs_on_industry_id"
t.index ["job_id"], name: "index_industries_jobs_on_job_id"
end
create_table "jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "company_id"
t.string "title"
t.string "level"
t.string "salary"
t.string "experience"
t.text "description"
t.date "expiration_date"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["company_id"], name: "index_jobs_on_company_id"
end
create_table "locations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "area"
t.string "city"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "locations_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "job_id"
t.bigint "location_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["job_id"], name: "index_locations_jobs_on_job_id"
t.index ["location_id"], name: "index_locations_jobs_on_location_id"
end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "email"
t.string "full_name"
t.string "curriculum_vitae"
t.string "password"
t.boolean "admin"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_foreign_key "applied_jobs", "jobs"
add_foreign_key "applied_jobs", "users"
add_foreign_key "favorites", "jobs"
add_foreign_key "favorites", "users"
add_foreign_key "histories", "jobs"
add_foreign_key "histories", "users"
add_foreign_key "jobs", "companies"
add_foreign_key "locations_jobs", "jobs"
add_foreign_key "locations_jobs", "locations"
end
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
user: one
job: one
full_name: MyString
email: MyString
curriculum_vitae: MyString
two:
user: two
job: two
full_name: MyString
email: MyString
curriculum_vitae: MyString
# Read about fixtures at http://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 http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
user: one
job: one
two:
user: two
job: two
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
user: one
job: one
two:
user: two
job: two
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
two:
name: MyString
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
job: one
industry: one
two:
job: two
industry: two
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
company: one
title: MyString
level: MyString
salary: MyString
experience: MyString
description: MyText
expiration_date: 2020-07-15
two:
company: two
title: MyString
level: MyString
salary: MyString
experience: MyString
description: MyText
expiration_date: 2020-07-15
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
area: MyString
city: MyString
two:
area: MyString
city: MyString
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
job: one
location: one
two:
job: two
location: two
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
email: MyString
full_name: MyString
curriculum_vitae: MyString
password: MyString
admin: false
two:
email: MyString
full_name: MyString
curriculum_vitae: MyString
password: MyString
admin: false
require 'test_helper'
class AppliedJobTest < 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 FavoriteTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class HistoryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class IndustriesJobTest < 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 LocationTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class LocationsJobTest < 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