Commit a35aba16 by Ngô Trung Hưng

Merge branch 'createdb' into 'master'

created DB

See merge request !1
parents 013e312f c792a168
Pipeline #712 failed with stages
in 0 seconds
# frozen_string_literal: true
# Description/Explanation of Person class
class ApplicationRecord < ActiveRecord::Base class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true self.abstract_class = true
end end
# frozen_string_literal: true
# Description/Explanation of Person class
class AppliedJob < ApplicationRecord
belongs_to :user
belongs_to :job
end
# frozen_string_literal: true
# Description/Explanation of Person class
class City < ApplicationRecord
has_many :city_jobs
has_many :jobs, through: :city_jobs
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CityJob < ApplicationRecord
belongs_to :city
belongs_to :job
end
# frozen_string_literal: true
# Description/Explanation of Person class
class Company < ApplicationRecord
has_many :jobs
end
# frozen_string_literal: true
# Description/Explanation of Person class
class Favorite < ApplicationRecord
belongs_to :user
belongs_to :job
end
# frozen_string_literal: true
# Description/Explanation of Person class
class History < ApplicationRecord
belongs_to :user
belongs_to :job
end
# frozen_string_literal: true
# Description/Explanation of Person class
class Industry < ApplicationRecord
has_many :industry_jobs
has_many :jobs, through: :industry_jobs
end
# frozen_string_literal: true
# Description/Explanation of Person class
class IndustryJob < ApplicationRecord
belongs_to :industry
belongs_to :job
end
# frozen_string_literal: true
# Description/Explanation of Person class
class Job < ApplicationRecord
belongs_to :company
has_many :industry_jobs
has_many :industries, through: :industry_jobs
has_many :city_jobs
has_many :cities, through: :city_jobs
has_many :applied_jobs
has_many :users, through: :applied_jobs
has_many :histories
has_many :favorites
end
# frozen_string_literal: true
# Description/Explanation of Person class
class User < ApplicationRecord
has_many :applied_jobs
has_many :jobs, through: :applied_jobs
has_many :histories
has_many :favorites
end
...@@ -14,7 +14,7 @@ default: &default ...@@ -14,7 +14,7 @@ default: &default
encoding: utf8 encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root username: root
password: password: '1'
socket: /var/run/mysqld/mysqld.sock socket: /var/run/mysqld/mysqld.sock
development: development:
......
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateCompanies < ActiveRecord::Migration[5.2]
def change
create_table :companies, options: 'COLLATE=utf8_general_ci' do |t|
t.string :name
t.string :address
t.text :short_description
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateCities < ActiveRecord::Migration[5.2]
def change
create_table :cities, options: 'COLLATE=utf8_general_ci' do |t|
t.string :name
t.boolean :area
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateIndustries < ActiveRecord::Migration[5.2]
def change
create_table :industries, options: 'COLLATE=utf8_general_ci' do |t|
t.string :name
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateJobs < ActiveRecord::Migration[5.2]
def change
create_table :jobs, options: 'COLLATE=utf8_general_ci' do |t|
t.string :name
t.integer :company_id
t.string :level
t.string :experience
t.string :salary
t.datetime :create_date
t.datetime :expiration_date
t.text :description
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateHistories < ActiveRecord::Migration[5.2]
def change
create_table :histories, options: 'COLLATE=utf8_general_ci' do |t|
t.integer :user_id
t.integer :job_id
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateFavorites < ActiveRecord::Migration[5.2]
def change
create_table :favorites, options: 'COLLATE=utf8_general_ci' do |t|
t.integer :user_id
t.integer :job_id
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users, options: 'COLLATE=utf8_general_ci' do |t|
t.string :email
t.string :name
t.string :password_digest
t.text :cv
t.boolean :admin, default: false
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateCityJobs < ActiveRecord::Migration[5.2]
def change
create_table :city_jobs, options: 'COLLATE=utf8_general_ci' do |t|
t.references :job
t.references :city
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateIndustryJobs < ActiveRecord::Migration[5.2]
def change
create_table :industry_jobs, options: 'COLLATE=utf8_general_ci' do |t|
t.references :industry
t.references :job
t.timestamps
end
end
end
# frozen_string_literal: true
# Description/Explanation of Person class
class CreateAppliedJobs < ActiveRecord::Migration[5.2]
def change
create_table :applied_jobs, options: 'COLLATE=utf8_general_ci' do |t|
t.references :user
t.references :job
t.string :name
t.string :email
t.text :cv
t.timestamps
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.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_07_28_021412) 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 "name"
t.string "email"
t.text "cv"
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 "cities", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "name"
t.boolean "area"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "city_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "job_id"
t.bigint "city_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["city_id"], name: "index_city_jobs_on_city_id"
t.index ["job_id"], name: "index_city_jobs_on_job_id"
end
create_table "companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "name"
t.string "address"
t.text "short_description"
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.integer "user_id"
t.integer "job_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "histories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.integer "user_id"
t.integer "job_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
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 "industry_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "industry_id"
t.bigint "job_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["industry_id"], name: "index_industry_jobs_on_industry_id"
t.index ["job_id"], name: "index_industry_jobs_on_job_id"
end
create_table "jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "name"
t.integer "company_id"
t.string "level"
t.string "experience"
t.string "salary"
t.datetime "create_date"
t.datetime "expiration_date"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "email"
t.string "name"
t.string "password_digest"
t.text "cv"
t.boolean "admin", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
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