21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-05 02:05:09 +02:00

Very basic seeds

This commit is contained in:
Colin Darie 2018-06-04 14:02:15 +02:00
parent cc84d873d3
commit e6283fac6c
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -1,7 +1,57 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
Notification.destroy_all
Check.destroy_all
User.destroy_all
user1 = User.create!(
email: "colin@example.org",
password: "password",
tos_accepted: true,
confirmed_at: Time.now
)
check_chexpire_org = Check.create!(
user: user1,
kind: :domain,
domain: "chexpire.org",
domain_expires_at: 1.week.from_now,
domain_updated_at: 6.months.ago,
domain_created_at: Time.new(2016, 8, 4, 12, 15, 1),
comment: "The date are fake, this is a seed !",
vendor: "Some random registrar",
)
check_chexpire_org_error = Check.create!(
user: user1,
kind: :domain,
domain: "chexpire.org",
domain_expires_at: 1.week.from_now,
domain_updated_at: 6.months.ago,
domain_created_at: Time.new(2016, 8, 4, 12, 15, 1),
comment: "The date are fake, this is a seed !",
vendor: "Some random registrar",
last_run_at: 20.minutes.ago,
last_success_at: 4.days.ago,
)
Notification.create!(
check: check_chexpire_org,
delay: 15,
channel: :email,
recipient: "colin@example.org",
status: :pending,
)
Notification.create!(
check: check_chexpire_org_error,
delay: 15,
channel: :email,
recipient: "colin@example.org",
status: :pending,
)
puts "\e[0;32mDone 👌\e[0m"
puts " "
puts "--------------------"
puts "Users: #{User.count}"
puts "Checks: #{Check.count}"
puts "Notifications: #{Notification.count}"