Use a single populate script with faker data
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
require_relative "../../config/environment"
|
||||
require "faker"
|
||||
|
||||
CARDS_COUNT = ARGV.first&.to_i || 10_000
|
||||
COLLECTIONS_COUNT = ARGV.second&.to_i || 1
|
||||
|
||||
ApplicationRecord.current_tenant = ApplicationRecord.tenants.first
|
||||
Current.session = Session.first
|
||||
|
||||
puts "Creating #{CARDS_COUNT} cards across #{COLLECTIONS_COUNT} collection(s)"
|
||||
|
||||
COLLECTIONS_COUNT.times do
|
||||
Collection.create! name: Faker::Company.buzzword, all_access: true
|
||||
print "."
|
||||
end
|
||||
|
||||
CARDS_COUNT.times do
|
||||
card = Collection.take.cards.create! \
|
||||
title: Faker::Company.bs, description: Faker::Hacker.say_something_smart, status: :published
|
||||
|
||||
print "."
|
||||
end
|
||||
@@ -1,13 +0,0 @@
|
||||
require_relative "../../config/environment"
|
||||
|
||||
CARDS_COUNT = 10_000
|
||||
|
||||
# 37signals seed
|
||||
ApplicationRecord.current_tenant = "897362094"
|
||||
Current.session = Session.first
|
||||
collection = Collection.first
|
||||
|
||||
CARDS_COUNT.times do |index|
|
||||
card = collection.cards.create!(title: "Card #{index}", status: :published)
|
||||
print "."
|
||||
end
|
||||
@@ -1,17 +0,0 @@
|
||||
require_relative "../../config/environment"
|
||||
|
||||
COLLECTIONS_COUNT = 100
|
||||
CARDS_PER_COLLECTION = 50
|
||||
|
||||
ApplicationRecord.current_tenant = "development-tenant"
|
||||
account = Account.sole
|
||||
user = account.users.first
|
||||
Current.session = user.sessions.last
|
||||
workflow = account.workflows.first
|
||||
|
||||
COLLECTIONS_COUNT.times do |collection_index|
|
||||
collection = Collection.create!(name: "Collection #{collection_index}", creator: user, workflow: workflow)
|
||||
CARDS_PER_COLLECTION.times do |card_index|
|
||||
collection.cards.create!(title: "Card #{card_index}", creator: user, status: :published)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user