Skip to content

Commit 263ee74

Browse files
committed
Add command to remove a specific schema
1 parent 147b801 commit 263ee74

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
2+
// See the LICENCE file in the repository root for full licence text.
3+
4+
using System.Threading;
5+
using McMaster.Extensions.CommandLineUtils;
6+
using osu.Server.QueueProcessor;
7+
using StackExchange.Redis;
8+
9+
namespace osu.ElasticIndexer.Commands.Index;
10+
11+
[Command("remove", Description = "Remove specified schema.")]
12+
public class RemoveSchemaCommand
13+
{
14+
private readonly ConnectionMultiplexer redis = RedisAccess.GetConnection();
15+
16+
[Argument(0, "name", "The name of the schema to remove.")]
17+
public string Name { get; set; } = string.Empty;
18+
19+
public int OnExecute(CancellationToken token)
20+
{
21+
redis.RemoveActiveSchema(Name);
22+
return 0;
23+
}
24+
}

osu.ElasticIndexer/Commands/IndexCommands.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace osu.ElasticIndexer.Commands
99
[Command("index", Description = "Index management commands.")]
1010
[Subcommand(typeof(ListIndicesCommand))]
1111
[Subcommand(typeof(NukeAllIndicesCommand))]
12+
[Subcommand(typeof(RemoveSchemaCommand))]
1213
[Subcommand(typeof(CloseIndexCommand))]
1314
[Subcommand(typeof(DeleteIndexCommand))]
1415
[Subcommand(typeof(OpenIndexCommand))]

0 commit comments

Comments
 (0)