2022-07-18 10:47:54 +02:00
|
|
|
# Create tenant
|
|
|
|
|
tenant = Tenant.create(
|
2024-01-24 18:37:54 +01:00
|
|
|
site_name: 'Default Site Name',
|
2022-07-18 10:47:54 +02:00
|
|
|
subdomain: 'default',
|
|
|
|
|
status: 'active'
|
|
|
|
|
)
|
|
|
|
|
Current.tenant = tenant
|
|
|
|
|
|
2019-08-24 13:35:01 +02:00
|
|
|
# Create an admin user and confirm its email automatically
|
2023-01-18 21:11:27 +01:00
|
|
|
owner = User.create(
|
2019-09-23 18:41:38 +02:00
|
|
|
full_name: 'Admin',
|
|
|
|
|
email: 'admin@example.com',
|
|
|
|
|
password: 'password',
|
2023-01-18 21:11:27 +01:00
|
|
|
role: 'owner',
|
2019-09-23 18:41:38 +02:00
|
|
|
confirmed_at: Time.zone.now
|
|
|
|
|
)
|
2019-08-24 13:35:01 +02:00
|
|
|
|
2024-05-03 18:11:07 +02:00
|
|
|
tenant.tenant_billing = TenantBilling.create!(status: 'perpetual')
|
|
|
|
|
|
2024-01-24 18:37:54 +01:00
|
|
|
CreateWelcomeEntitiesWorkflow.new().run
|
2019-09-16 18:02:52 +02:00
|
|
|
|
2019-08-25 11:26:28 +02:00
|
|
|
# Let the user know how to log in with admin account
|
2022-07-18 10:47:54 +02:00
|
|
|
puts "A default tenant has been created with name #{tenant.site_name}"
|
2019-08-25 11:26:28 +02:00
|
|
|
puts 'A default admin account has been created. Credentials:'
|
2023-01-18 21:11:27 +01:00
|
|
|
puts "-> email: #{owner.email}"
|
|
|
|
|
puts "-> password: #{owner.password}"
|