mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Realistic demo data for performance testing (#2361)
* Realistic demo data for performance testing * Add note about performance testing * Fix bugbot issues * More realistic account values
This commit is contained in:
parent
0d62e60da1
commit
5a4c955522
16 changed files with 2166 additions and 474 deletions
31
app/models/demo/data_cleaner.rb
Normal file
31
app/models/demo/data_cleaner.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
# SAFETY: Only operates in development/test environments to prevent data loss
|
||||
class Demo::DataCleaner
|
||||
SAFE_ENVIRONMENTS = %w[development test]
|
||||
|
||||
def initialize
|
||||
ensure_safe_environment!
|
||||
end
|
||||
|
||||
# Main entry point for destroying all demo data
|
||||
def destroy_everything!
|
||||
puts "Clearing existing data..."
|
||||
|
||||
# Rails associations handle cascading deletes
|
||||
Family.destroy_all
|
||||
Setting.destroy_all
|
||||
InviteCode.destroy_all
|
||||
ExchangeRate.destroy_all
|
||||
Security.destroy_all
|
||||
Security::Price.destroy_all
|
||||
|
||||
puts "Data cleared"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ensure_safe_environment!
|
||||
unless SAFE_ENVIRONMENTS.include?(Rails.env)
|
||||
raise SecurityError, "Demo::DataCleaner can only be used in #{SAFE_ENVIRONMENTS.join(', ')} environments. Current: #{Rails.env}"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue