author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 21 Mar 2016 13:15:35 +0100 | |
changeset 314 | 9ac0be200068 |
parent 273 | b6df14688f46 |
permissions | -rw-r--r-- |
33 | 1 |
# This file should contain all the record creation needed to seed the database with its default values. |
2 |
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). |
|
3 |
# |
|
4 |
# Examples: |
|
5 |
# |
|
6 |
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) |
|
7 |
# Mayor.create(name: 'Emanuel', city: cities.first) |
|
225
1717c8a3eba6
Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
8 |
|
1717c8a3eba6
Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
9 |
require 'json' |
273
b6df14688f46
Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
225
diff
changeset
|
10 |
require File.join(Rails.root, 'db', 'seeds-common') |
225
1717c8a3eba6
Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
11 |
|
273
b6df14688f46
Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
225
diff
changeset
|
12 |
for m in 1..12 |
b6df14688f46
Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
225
diff
changeset
|
13 |
timestamp = Time.new(2014, m, 1, 10, 10, 10) |
b6df14688f46
Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
225
diff
changeset
|
14 |
db_seed(File.join(Rails.root, 'db', 'seeds'), timestamp) |
225
1717c8a3eba6
Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
15 |
end |