Commit 2bf8b8d9 by nnnghia98

migrate database

parent f51d5d9e
Pipeline #233 failed with stages
in 0 seconds
class City < ApplicationRecord
end
class CityJob < ApplicationRecord
belongs_to :city
belongs_to :job
end
class Company < ApplicationRecord
end
class CrawlUrl < ApplicationRecord
end
class Industry < ApplicationRecord
end
class IndustryJob < ApplicationRecord
belongs_to :industry
belongs_to :job
end
class Job < ApplicationRecord
belongs_to :company
end
class User < ApplicationRecord
end
class UserJob < ApplicationRecord
belongs_to :user
belongs_to :job
end
class CreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :email, unique: true
t.string :username, unique: true
t.integer :role
t.string :password_digest
t.string :reset_digest
t.datetime :reset_sent_at
t.string :remember_digest
t.string :activation_digest
t.datetime :activated_at
t.boolean :activated
t.string :cv_path
t.timestamps
end
end
end
class CreateCompanies < ActiveRecord::Migration[6.0]
def change
create_table :companies do |t|
t.string :name
t.string :email, unique: true
t.text :description
t.string :address
t.timestamps
end
end
end
class CreateCities < ActiveRecord::Migration[6.0]
def change
create_table :cities do |t|
t.string :name, unique: true
t.string :region
t.timestamps
end
end
end
class CreateIndustries < ActiveRecord::Migration[6.0]
def change
create_table :industries do |t|
t.string :name
t.timestamps
end
end
end
class CreateJobs < ActiveRecord::Migration[6.0]
def change
create_table :jobs do |t|
t.string :title
t.string :level
t.string :salary
t.string :other_salary
t.text :description
t.text :short_des
t.text :requirement
t.integer :category
t.datetime :post_date
t.datetime :expiration_date
t.references :company, null: false, foreign_key: true
t.timestamps
end
end
end
class CreateUserJobs < ActiveRecord::Migration[6.0]
def change
create_table :user_jobs do |t|
t.references :user, null: false, foreign_key: true
t.references :job, null: false, foreign_key: true
t.datetime :applied_at
t.integer :relation
t.timestamps
end
end
end
class CreateCityJobs < ActiveRecord::Migration[6.0]
def change
create_table :city_jobs do |t|
t.references :city, null: false, foreign_key: true
t.references :job, null: false, foreign_key: true
t.timestamps
end
end
end
class CreateIndustryJobs < ActiveRecord::Migration[6.0]
def change
create_table :industry_jobs do |t|
t.references :industry, null: false, foreign_key: true
t.references :job, null: false, foreign_key: true
t.timestamps
end
end
end
class CreateCrawlUrls < ActiveRecord::Migration[6.0]
def change
create_table :crawl_urls do |t|
t.string :url
t.string :title
t.boolean :crawled, default: false
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.
#
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `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: 2019_11_26_083335) do
create_table "cities", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "name"
t.string "region"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "city_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "city_id", null: false
t.bigint "job_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, 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 "email"
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 "crawl_urls", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "url"
t.string "title"
t.boolean "crawled", default: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "industries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", 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 "industry_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "industry_id", null: false
t.bigint "job_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, 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 "title"
t.string "level"
t.string "salary"
t.string "other_salary"
t.text "description"
t.text "short_des"
t.text "requirement"
t.integer "category"
t.datetime "post_date"
t.datetime "expiration_date"
t.bigint "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 "user_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "job_id", null: false
t.datetime "applied_at"
t.integer "relation"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["job_id"], name: "index_user_jobs_on_job_id"
t.index ["user_id"], name: "index_user_jobs_on_user_id"
end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "email"
t.string "username"
t.integer "role"
t.string "password_digest"
t.string "reset_digest"
t.datetime "reset_sent_at"
t.string "remember_digest"
t.string "activation_digest"
t.datetime "activated_at"
t.boolean "activated"
t.string "cv_path"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
add_foreign_key "city_jobs", "cities"
add_foreign_key "city_jobs", "jobs"
add_foreign_key "industry_jobs", "industries"
add_foreign_key "industry_jobs", "jobs"
add_foreign_key "jobs", "companies"
add_foreign_key "user_jobs", "jobs"
add_foreign_key "user_jobs", "users"
end
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
region: MyString
two:
name: MyString
region: MyString
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
city: one
job: one
two:
city: two
job: two
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
email: MyString
description: MyText
address: MyString
two:
name: MyString
email: MyString
description: MyText
address: MyString
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
url: MyString
title: MyString
crawled: false
two:
url: MyString
title: MyString
crawled: false
# 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:
industry: one
job: one
two:
industry: two
job: two
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
title: MyString
level: MyString
salary: MyString
other_salary: MyString
description: MyText
short_des: MyText
requirement: MyText
category: 1
post_date: 2019-11-26 15:31:10
expiration_date: 2019-11-26 15:31:10
company: one
two:
title: MyString
level: MyString
salary: MyString
other_salary: MyString
description: MyText
short_des: MyText
requirement: MyText
category: 1
post_date: 2019-11-26 15:31:10
expiration_date: 2019-11-26 15:31:10
company: two
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
user: one
job: one
applied_at: 2019-11-26 15:31:51
relation: 1
two:
user: two
job: two
applied_at: 2019-11-26 15:31:51
relation: 1
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
first_name: MyString
last_name: MyString
email: MyString
username: MyString
role: 1
password_digest: MyString
reset_digest: MyString
reset_sent_at: 2019-11-26 15:28:50
remember_digest: MyString
activation_digest: MyString
activated_at: 2019-11-26 15:28:50
activated: false
cv_path: MyString
two:
first_name: MyString
last_name: MyString
email: MyString
username: MyString
role: 1
password_digest: MyString
reset_digest: MyString
reset_sent_at: 2019-11-26 15:28:50
remember_digest: MyString
activation_digest: MyString
activated_at: 2019-11-26 15:28:50
activated: false
cv_path: MyString
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 CrawlUrlTest < 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 UserJobTest < 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