From 5c977c6be799024b97c79a5582e933afaba16337 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Thu, 26 Sep 2024 13:20:44 -0500 Subject: [PATCH] chore: rename 'first-organization' to 'coder' (#14808) Rename the first-organization original name. Users can change from the original name. --- cli/testdata/coder_list_--output_json.golden | 2 +- coderd/database/dbmem/dbmem.go | 4 ++-- .../000259_rename_first_organization.down.sql | 3 +++ .../migrations/000259_rename_first_organization.up.sql | 10 ++++++++++ enterprise/cli/create_test.go | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 coderd/database/migrations/000259_rename_first_organization.down.sql create mode 100644 coderd/database/migrations/000259_rename_first_organization.up.sql diff --git a/cli/testdata/coder_list_--output_json.golden b/cli/testdata/coder_list_--output_json.golden index c65c1cd61d..8f45fd79cf 100644 --- a/cli/testdata/coder_list_--output_json.golden +++ b/cli/testdata/coder_list_--output_json.golden @@ -7,7 +7,7 @@ "owner_name": "testuser", "owner_avatar_url": "", "organization_id": "[first org ID]", - "organization_name": "first-organization", + "organization_name": "coder", "template_id": "[template ID]", "template_name": "test-template", "template_display_name": "", diff --git a/coderd/database/dbmem/dbmem.go b/coderd/database/dbmem/dbmem.go index dbf8e5514e..6500fb3278 100644 --- a/coderd/database/dbmem/dbmem.go +++ b/coderd/database/dbmem/dbmem.go @@ -92,8 +92,8 @@ func New() database.Store { // Always start with a default org. Matching migration 198. defaultOrg, err := q.InsertOrganization(context.Background(), database.InsertOrganizationParams{ ID: uuid.New(), - Name: "first-organization", - DisplayName: "first-organization", + Name: "coder", + DisplayName: "Coder", Description: "Builtin default organization.", Icon: "", CreatedAt: dbtime.Now(), diff --git a/coderd/database/migrations/000259_rename_first_organization.down.sql b/coderd/database/migrations/000259_rename_first_organization.down.sql new file mode 100644 index 0000000000..e76e68e8b8 --- /dev/null +++ b/coderd/database/migrations/000259_rename_first_organization.down.sql @@ -0,0 +1,3 @@ +-- Leave the name as 'coder', there is no downside. +-- The old name 'first-organization' is not used anywhere, just the +-- is_default property. diff --git a/coderd/database/migrations/000259_rename_first_organization.up.sql b/coderd/database/migrations/000259_rename_first_organization.up.sql new file mode 100644 index 0000000000..84bd45373c --- /dev/null +++ b/coderd/database/migrations/000259_rename_first_organization.up.sql @@ -0,0 +1,10 @@ +UPDATE + organizations +SET + name = 'coder', + display_name = 'Coder' +WHERE + -- The old name was too long. + name = 'first-organization' + AND is_default = true +; diff --git a/enterprise/cli/create_test.go b/enterprise/cli/create_test.go index 33423e366a..1c0804e4d9 100644 --- a/enterprise/cli/create_test.go +++ b/enterprise/cli/create_test.go @@ -202,6 +202,6 @@ func TestEnterpriseCreate(t *testing.T) { err := inv.Run() require.Error(t, err) // The error message should indicate the flag to fix the issue. - require.ErrorContains(t, err, fmt.Sprintf("--org=%q", "first-organization")) + require.ErrorContains(t, err, fmt.Sprintf("--org=%q", "coder")) }) }