2016-02-12 23:52:43 +08:00
|
|
|
include UsersGenerator
|
|
|
|
|
2021-11-16 04:36:06 +08:00
|
|
|
if ActiveRecord::Base.connection.migration_context.needs_migration?
|
|
|
|
raise "There are pending migrations. Run 'rails db:migrate' first."
|
|
|
|
end
|
|
|
|
|
2020-08-18 19:06:05 +08:00
|
|
|
MyModuleStatusFlow.ensure_default
|
|
|
|
|
2018-01-18 22:25:51 +08:00
|
|
|
if User.count.zero?
|
|
|
|
if ENV['ADMIN_NAME'].present? &&
|
|
|
|
ENV['ADMIN_EMAIL'].present? &&
|
|
|
|
ENV['ADMIN_PASSWORD'].present?
|
|
|
|
admin_name = ENV['ADMIN_NAME']
|
|
|
|
admin_email = ENV['ADMIN_EMAIL']
|
|
|
|
admin_password = ENV['ADMIN_PASSWORD']
|
|
|
|
else
|
|
|
|
admin_name = 'Admin'
|
|
|
|
admin_email = 'admin@scinote.net'
|
|
|
|
admin_password = 'inHisHouseAtRlyehDeadCthulhuWaitsDreaming'
|
|
|
|
end
|
|
|
|
|
|
|
|
# Create admin user
|
|
|
|
create_user(
|
|
|
|
admin_name,
|
|
|
|
admin_email,
|
|
|
|
admin_password,
|
|
|
|
true,
|
|
|
|
Constants::DEFAULT_PRIVATE_TEAM_NAME,
|
|
|
|
[],
|
|
|
|
Extends::INITIAL_USER_OPTIONS
|
|
|
|
)
|
2022-07-27 16:10:32 +08:00
|
|
|
|
|
|
|
if LabelTemplate.count.positive?
|
|
|
|
LabelTemplate.first.update(
|
|
|
|
created_by_id: Team.first.created_by_id,
|
|
|
|
last_modified_by_id: Team.first.created_by_id,
|
|
|
|
team_id: Team.first.id
|
|
|
|
)
|
|
|
|
end
|
2018-01-18 22:25:51 +08:00
|
|
|
end
|