Skip to content

Commit

Permalink
Make the database seeder better
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrooksuk committed Nov 27, 2024
1 parent 31545ca commit 1f43fb3
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,48 +57,48 @@ public function run(): void
]);

Schedule::create([
'name' => 'Database Maintenance',
'message' => 'We will be conducting maintenance on our database servers. You may experience degraded performance during this time.',
'name' => 'Documentation Maintenance',
'message' => 'We will be conducting maintenance on our documentation servers. You may experience degraded performance during this time.',
'scheduled_at' => now()->addHours(24),
'completed_at' => null,
]);

$componentGroup = ComponentGroup::create([
'name' => 'Checkmango',
'name' => 'Cachet',
'collapsed' => ComponentGroupVisibilityEnum::expanded,
'visible' => ResourceVisibilityEnum::guest,
]);

$componentGroup->components()->createMany([
[
'name' => 'Dashboard',
'description' => 'The Checkmango Dashboard.',
'link' => 'https://checkmango.com',
'name' => 'Cachet Website',
'description' => 'The Cachet Website.',
'link' => 'https://cachethq.io',
'status' => ComponentStatusEnum::operational,
], [
'name' => 'API',
'description' => 'The Checkmango API.',
'link' => 'https://developers.checkmango.com',
'name' => 'Cachet Documentation',
'description' => 'The Checkmango Documentation.',
'link' => 'https://docs.cachethq.io',
'status' => ComponentStatusEnum::operational,
], [
'name' => 'Documentation',
'description' => 'The Checkmango Documentation.',
'link' => 'https://docs.checkmango.com',
'status' => ComponentStatusEnum::performance_issues,
'name' => 'Cachet Blog',
'description' => 'The Cachet Blog.',
'link' => 'https://blog.cachethq.io',
'status' => ComponentStatusEnum::operational,
],
]);

Component::create([
'name' => 'Cachet',
'description' => 'The open-source status page system.',
'link' => 'https://cachethq.io',
'name' => 'Laravel Artisan Cheatsheet',
'description' => 'The Laravel Artisan Cheatsheet.',
'link' => 'https://artisan.page',
'status' => ComponentStatusEnum::operational,
]);

$metric = Metric::create([
'name' => 'Checkmango Requests',
'name' => 'Cachet API Requests',
'suffix' => 'req/s',
'description' => 'The number of requests to the Checkmango API.',
'description' => 'The number of requests to the Cachet API.',
'default_view' => MetricViewEnum::last_hour,
'calc_type' => MetricTypeEnum::average,
'display_chart' => true,
Expand Down Expand Up @@ -147,7 +147,7 @@ public function run(): void
$incident = Incident::create([
'name' => 'Documentation Performance Degradation',
'message' => 'We\'re investigating an issue with our documentation causing the site to be slow.',
'status' => IncidentStatusEnum::investigating,
'status' => IncidentStatusEnum::fixed,
'visible' => ResourceVisibilityEnum::guest,
'guid' => Str::uuid(),
'created_at' => $timestamp = now()->subMinutes(30),
Expand All @@ -158,6 +158,15 @@ public function run(): void
$incident->incidentUpdates()->create([
'status' => IncidentStatusEnum::identified,
'message' => 'We\'ve identified the issue and are working on a fix.',
'created_at' => $timestamp = $incident->created_at->addMinutes(15),
'updated_at' => $timestamp,
]);

$incident->incidentUpdates()->create([
'status' => IncidentStatusEnum::fixed,
'message' => 'The documentation is now back online. Happy reading!',
'created_at' => $timestamp = $incident->created_at->addMinutes(25),
'updated_at' => $timestamp,
]);

IncidentTemplate::create([
Expand Down

0 comments on commit 1f43fb3

Please sign in to comment.