Skip to content

Commit 9751a45

Browse files
authored
add deprecation notices to cli cmds (#934)
1 parent a136a64 commit 9751a45

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

internal/cmd/db_attach.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import (
88
"github.com/tursodatabase/turso-cli/internal/turso"
99
)
1010

11+
func showAttachDeprecationNotice() {
12+
fmt.Println(internal.Warn("Notice: Database ATTACH is deprecated."))
13+
fmt.Println(internal.Warn("For more information, visit: https://tur.so/attach-deprecated\n"))
14+
}
15+
1116
func init() {
1217
dbConfigCmd.AddCommand(dbAttachCmd)
1318
dbAttachCmd.AddCommand(dbEnableAttachCmd)
@@ -27,6 +32,7 @@ var dbEnableAttachCmd = &cobra.Command{
2732
Args: cobra.ExactArgs(1),
2833
ValidArgsFunction: dbNameArg,
2934
RunE: func(cmd *cobra.Command, args []string) error {
35+
showAttachDeprecationNotice()
3036
cmd.SilenceUsage = true
3137
return updateAttachStatus(args[0], true)
3238
},
@@ -38,6 +44,7 @@ var dbDisableAttachCmd = &cobra.Command{
3844
Args: cobra.ExactArgs(1),
3945
ValidArgsFunction: dbNameArg,
4046
RunE: func(cmd *cobra.Command, args []string) error {
47+
showAttachDeprecationNotice()
4148
cmd.SilenceUsage = true
4249
return updateAttachStatus(args[0], false)
4350
},
@@ -49,6 +56,7 @@ var dbShowAttachStatusCmd = &cobra.Command{
4956
Args: cobra.ExactArgs(1),
5057
ValidArgsFunction: dbNameArg,
5158
RunE: func(cmd *cobra.Command, args []string) error {
59+
showAttachDeprecationNotice()
5260
cmd.SilenceUsage = true
5361
client, err := authedTursoClient()
5462
if err != nil {

internal/cmd/db_create.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import (
1212
"github.com/tursodatabase/turso-cli/internal/turso"
1313
)
1414

15+
func showSchemaDeprecationNotice() {
16+
fmt.Println(internal.Warn("Notice: Schema Databases are deprecated."))
17+
fmt.Println(internal.Warn("For more information, visit: https://tur.so/schema-deprecated\n"))
18+
}
19+
1520
const MaxDumpFileSizeBytes = 8 << 30
1621

1722
func init() {
@@ -39,6 +44,12 @@ var createCmd = &cobra.Command{
3944
Short: "Create a database.",
4045
Args: cobra.MaximumNArgs(1),
4146
ValidArgsFunction: noFilesArg,
47+
PreRunE: func(cmd *cobra.Command, args []string) error {
48+
if schemaFlag != "" || typeFlag == "schema" {
49+
showSchemaDeprecationNotice()
50+
}
51+
return nil
52+
},
4253
RunE: func(cmd *cobra.Command, args []string) error {
4354
cmd.SilenceUsage = true
4455
name, err := getDatabaseName(args)

internal/cmd/group_locations.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import (
1010
"golang.org/x/exp/maps"
1111
)
1212

13+
func showEdgeReplicaDeprecationNotice() {
14+
fmt.Println(internal.Warn("Notice: Edge Replicas are deprecated."))
15+
fmt.Println(internal.Warn("For more information, visit: https://tur.so/replicas-deprecated\n"))
16+
}
17+
1318
var groupLocationsCmd = &cobra.Command{
1419
Use: "locations",
1520
Short: "Manage your database group locations",
@@ -29,6 +34,8 @@ var groupLocationsListCmd = &cobra.Command{
2934
Args: cobra.ExactArgs(1),
3035
ValidArgsFunction: noFilesArg,
3136
RunE: func(cmd *cobra.Command, args []string) error {
37+
showEdgeReplicaDeprecationNotice()
38+
3239
group := args[0]
3340
if group == "" {
3441
return fmt.Errorf("the first argument must contain a group name")
@@ -56,6 +63,8 @@ var groupLocationAddCmd = &cobra.Command{
5663
Args: cobra.MinimumNArgs(1),
5764
ValidArgsFunction: locationsAddArgs,
5865
RunE: func(cmd *cobra.Command, args []string) error {
66+
showEdgeReplicaDeprecationNotice()
67+
5968
groupName := args[0]
6069
if groupName == "" {
6170
return fmt.Errorf("the first argument must contain a group name")
@@ -133,6 +142,8 @@ var groupsLocationsRmCmd = &cobra.Command{
133142
Args: cobra.MinimumNArgs(2),
134143
ValidArgsFunction: locationsRmArgs,
135144
RunE: func(cmd *cobra.Command, args []string) error {
145+
showEdgeReplicaDeprecationNotice()
146+
136147
groupName := args[0]
137148
if groupName == "" {
138149
return fmt.Errorf("the group flag is required")

0 commit comments

Comments
 (0)