Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VenJob
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Đường Sỹ Hoàng
VenJob
Commits
09737968
Commit
09737968
authored
Dec 10, 2019
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge tasks
parent
fcc712c5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
27 deletions
+22
-27
db/migrate/20191127073956_create_companies.rb
+1
-1
db/migrate/20191210034127_change_integer_limit_job.rb
+0
-5
db/schema.rb
+2
-2
lib/tasks/import_job_csv.rake
+19
-19
No files found.
db/migrate/20191127073956_create_companies.rb
View file @
09737968
class
CreateCompanies
<
ActiveRecord
::
Migration
[
6.0
]
class
CreateCompanies
<
ActiveRecord
::
Migration
[
6.0
]
def
change
def
change
create_table
:companies
do
|
t
|
create_table
:companies
do
|
t
|
t
.
string
:email
,
null:
false
,
default:
""
t
.
string
:email
t
.
text
:description
t
.
text
:description
t
.
string
:address
t
.
string
:address
t
.
string
:url
t
.
string
:url
...
...
db/migrate/20191210034127_change_integer_limit_job.rb
deleted
100644 → 0
View file @
fcc712c5
class
ChangeIntegerLimitJob
<
ActiveRecord
::
Migration
[
6.0
]
def
change
change_column
:jobs
,
:company_id
,
:integer
,
limit:
8
end
end
db/schema.rb
View file @
09737968
...
@@ -27,7 +27,7 @@ ActiveRecord::Schema.define(version: 2019_12_10_035904) do
...
@@ -27,7 +27,7 @@ ActiveRecord::Schema.define(version: 2019_12_10_035904) do
end
end
create_table
"companies"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"companies"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
t
.
string
"email"
,
default:
""
,
null:
false
t
.
string
"email"
t
.
text
"description"
t
.
text
"description"
t
.
string
"address"
t
.
string
"address"
t
.
string
"url"
t
.
string
"url"
...
@@ -56,7 +56,7 @@ ActiveRecord::Schema.define(version: 2019_12_10_035904) do
...
@@ -56,7 +56,7 @@ ActiveRecord::Schema.define(version: 2019_12_10_035904) do
t
.
string
"title"
t
.
string
"title"
t
.
text
"description"
t
.
text
"description"
t
.
text
"short_description"
t
.
text
"short_description"
t
.
bigint
"company_id"
t
.
integer
"company_id"
t
.
decimal
"salary"
,
precision:
10
t
.
decimal
"salary"
,
precision:
10
t
.
integer
"currency"
t
.
integer
"currency"
t
.
text
"requirement"
t
.
text
"requirement"
...
...
lib/tasks/import_job_csv.rake
View file @
09737968
...
@@ -2,25 +2,25 @@ require "csv"
...
@@ -2,25 +2,25 @@ require "csv"
namespace
:import_job_csv
do
namespace
:import_job_csv
do
desc
"Import CSV file into database"
desc
"Import CSV file into database"
task
create
_job: :environment
do
task
import
_job: :environment
do
file
=
"db/Venjob.csv"
CSV
.
foreach
(
"db/Venjob.csv"
,
headers:
true
)
do
|
row
|
CSV
.
foreach
(
file
,
headers:
true
)
do
|
row
|
company_params
=
{
job_hash
=
row
.
to_hash
email:
row
[
"contact email"
],
job
=
Job
.
where
(
id:
job_hash
[
"id"
])
name:
row
[
"company name"
],
if
job
.
count
==
1
address:
row
[
"company address"
],
job
.
first
.
update_attributes
(
job_hash
)
code:
row
[
"company id"
]
else
}
Job
.
create!
({
Company
.
create!
(
company_params
)
company_id:
row
[
4
],
job_params
=
{
company_name:
row
[
5
]
,
company_id:
Company
.
find_by
(
code:
row
[
"company id"
]).
id
,
location:
row
[
16
],
location:
row
[
"workplace"
],
title:
row
[
9
],
title:
row
[
"name"
],
description:
row
[
7
],
description:
row
[
"description"
],
position:
row
[
8
],
position:
row
[
"level"
],
salary:
row
[
11
],
salary:
row
[
"salary"
],
requirement:
row
[
10
]
requirement:
row
[
"requirement"
]
})
}
end
Job
.
create!
(
job_params
)
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment