Commit 22843861 by Ngô Trung Hưng

run migration

parent 19828549
......@@ -11,12 +11,14 @@ $main-color: #221f20;
width: 100%;
background-color: $main-color;
position: fixed;
box-shadow: 0px 2px 4px 2px #999;
}
.header_top {
display: flex;
justify-content: space-between;
max-width: 1200px;
margin: auto;
height: 100%;
}
.header_top_logo {
......@@ -66,7 +68,7 @@ $main-color: #221f20;
}
}
.link_item_menu_header_right {
font-size: 12px;
font-size: 13px;
line-height: 52px;
color: white;
&:hover {
......
class AppliedJob < ApplicationRecord
belongs_to :user
belongs_to :job
end
class City < ApplicationRecord
has_many :city_jobs
has_many :jobs, through: :city_jobs
end
class CityJob < ApplicationRecord
belongs_to :city
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 Industry < ApplicationRecord
has_many :industry_jobs
has_many :jobs, through: :industry_jobs
end
class IndustryJob < ApplicationRecord
belongs_to :industry
belongs_to :job
end
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
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
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password: '12345678'
password: '1'
socket: /var/run/mysqld/mysqld.sock
development:
......
......@@ -9,7 +9,7 @@ threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
port ENV.fetch("PORT") { 1111 }
# Specifies the `environment` that Puma will run in.
#
......
class CreateCompanies < ActiveRecord::Migration[5.2]
def change
create_table :companies do |t|
t.string :name
t.string :address
t.string :short_description
t.timestamps
end
end
end
class CreateCities < ActiveRecord::Migration[5.2]
def change
create_table :cities do |t|
t.string :name
t.boolean :area
t.timestamps
end
end
end
class CreateIndustries < ActiveRecord::Migration[5.2]
def change
create_table :industries do |t|
t.string :name
t.timestamps
end
end
end
class CreateJobs < ActiveRecord::Migration[5.2]
def change
create_table :jobs 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
class CreateHistories < ActiveRecord::Migration[5.2]
def change
create_table :histories do |t|
t.integer :user_id
t.integer :job_id
t.timestamps
end
end
end
class CreateFavorites < ActiveRecord::Migration[5.2]
def change
create_table :favorites do |t|
t.integer :user_id
t.integer :job_id
t.timestamps
end
end
end
class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users 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
class CreateCityJobs < ActiveRecord::Migration[5.2]
def change
create_table :city_jobs do |t|
# t.belongs_to :city, class_name: "city", foreign_key: "city_id"
# t.belongs_to :job, class_name: "job", foreign_key: "job_id"
t.references :job
t.references :city
t.timestamps
end
end
end
class CreateIndustryJobs < ActiveRecord::Migration[5.2]
def change
create_table :industry_jobs do |t|
t.references :industry
t.references :job
t.timestamps
end
end
end
class CreateAppliedJobs < ActiveRecord::Migration[5.2]
def change
create_table :applied_jobs 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_15_025243) do
create_table "applied_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", 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=latin1", 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=latin1", 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=latin1", force: :cascade do |t|
t.string "name"
t.string "address"
t.string "short_description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "favorites", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", 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=latin1", 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=latin1", 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=latin1", 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=latin1", 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=latin1", 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
require 'test_helper'
class AppliedJobTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class CityJobTest < 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 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 IndustryJobTest < 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