solid-adventure / trivial-api

Other
1 stars 1 forks source link

Introducing MockData::RegisterItems #290

Closed vgkids closed 2 months ago

vgkids commented 2 months ago

Before No easy way to create large amounts of mock data to performance tuning

After A module we can leverage in seed tasks, staging db's running in production mode, and daily cron to continually provide fresh mock data.

The header says it all:

#
# WARNING: This script will create a large number of records in your database.
#
#          DO NOT run this script on a production database.
#
#

# You must provide a valid app_id to run this script.
# You can also provide the following optional arguments:
# - row_count: the number of register items to create (default: 1000)
# - group_size: the number of register items to insert in a single query (default: 8000)
# - entries_per_item: the number of activity entries to create for each register item (default: 20)
# - start_at: the start date for the register items (default: 2016-01-02)
# - end_at: the end date for the register items (default: now)
#
# Example:
# MockData::RegisterItems.main({app_id: 100, row_count: 10, group_size: 20, entries_per_item: 2})

# Example With dates provided:
# MockData::RegisterItems.main({app_id: 100, row_count: 10, group_size: 20, entries_per_item: 2, start_at: '2025-01-01', end_at: '2025-01-10'})
vgkids commented 2 months ago

This is incorporates @drowninginflowers excellent payload generation work.