Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func showDatabaseDeprecationWarnings(databases ...civogo.Database) {
software := strings.ToLower(db.Software)

if software == "mysql" && !mysqlWarning {
utility.Warning("MySQL databases are deprecated and will be removed in a future release. Please consider migrating to PostgreSQL.")
utility.Warning("MySQL databases are deprecated and will be removed in a future release. Please consider checking the documentation https://www.civo.com/docs/database/mysql/dump-mysql to understand how to keep using MySQL with Civo")
mysqlWarning = true
}

if software == "postgresql" && strings.HasPrefix(db.SoftwareVersion, "14") && !pgWarning {
utility.Warning("PostgreSQL 14 is deprecated and will be removed in a future release. Please consider upgrading to a newer version.")
utility.Warning("PostgreSQL 14 is deprecated and will be removed in a future release. Please migrate to PostgreSQL 17. For migration guidance, see: https://www.civo.com/docs/database/postgresql/migrate-from-14-to-17")
pgWarning = true
}
}
Expand Down Expand Up @@ -69,7 +69,7 @@ func init() {
dbCreateCmd.Flags().StringVarP(&networkID, "network", "n", "", "the network to use for the database")
dbCreateCmd.Flags().StringVarP(&rulesFirewall, "firewall-rules", "u", "", "the firewall rules to use for the database")
dbCreateCmd.Flags().StringVarP(&size, "size", "s", "g3.db.small", "the size of the database. You can list available DB sizes by `civo size list -s database`")
dbCreateCmd.Flags().StringVarP(&software, "software", "m", "MySQL", "the software to use for the database. One of: MySQL, PostgreSQL. Please make sure you use the correct capitalisation.")
dbCreateCmd.Flags().StringVarP(&software, "software", "m", "PostgreSQL", "the software to use for the database.")
dbCreateCmd.Flags().StringVarP(&softwareVersion, "version", "v", "", "the version of the software to use for the database.")
dbCreateCmd.Flags().BoolVarP(&waitDatabase, "wait", "w", false, "a simple flag (e.g. --wait) that will cause the CLI to spin and wait for the database to be ACTIVE")

Expand Down
8 changes: 3 additions & 5 deletions cmd/database/database_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,17 @@ var dbCreateCmd = &cobra.Command{
os.Exit(1)
}

// Set default software to MySQL if not specified
if software == "" {
software = "mysql"
software = "postgresql"
}

software = strings.ToLower(software)

validSoftwares := map[string][]string{
"mysql": {"mysql"},
"postgresql": {"postgresql", "psql"},
}

apiSoftwareNames := map[string]string{
"mysql": "MySQL",
"postgresql": "PostgreSQL",
}

Expand All @@ -125,7 +123,7 @@ var dbCreateCmd = &cobra.Command{
}

if !softwareIsValid {
utility.Error("The provided software name is not valid. valid options are mysql, psql or postgresql")
utility.Error("The provided software name is not valid. Valid options are psql or postgresql")
os.Exit(1)
}

Expand Down
18 changes: 6 additions & 12 deletions doc/DTABASE_BACKUP_RESTORE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,43 @@ Manual backups are initiated by a user on-demand. These are useful for creating

To manually create a backup, follow the steps outlined in the Usage section.

* Support: PostgreSQL, MySQL
* Support: PostgreSQL

### Restore Process

The restore process allows you to recover your database from a previously created backup.

* Support: PostgreSQL, MySQL
* Support: PostgreSQL

# CLI Operations

## Create MySQL and PostgreSQL database
## Create a PostgreSQL database

```bash
❯ civo database create postgres-demo --size g3.db.medium --software PostgreSQL --version 14
Database (postgres-demo) with ID 65dd8173-f754-4c6c-b50a-7ddb6d5446c5 has been created
```

```bash
❯ civo database create mysql-demo --size g3.db.medium --software MySQL --version 8.0
Database (mysql-demo) with ID 0d328d59-98c3-4f68-8025-5b1633a1c287 has been created
```

```bash
❯ civo database ls
+--------+---------------+--------------+-------+------------+------------------+--------------+------+--------+
| ID | Name | Size | Nodes | Software | Software Version | Host | Port | Status |
+--------+---------------+--------------+-------+------------+------------------+--------------+------+--------+
| 65dd81 | postgres-demo | g3.db.medium | 1 | PostgreSQL | 14 | 31.28.88.149 | 5432 | Ready |
+--------+---------------+--------------+-------+------------+------------------+--------------+------+--------+
| 0d328d | mysql-demo | g3.db.medium | 1 | MySQL | 8.0 | 31.28.88.184 | 3306 | Ready |
+--------+---------------+--------------+-------+------------+------------------+--------------+------+--------+
To get the credentials for a database, use `civo db credential <name/ID>`
```

### List database backups

```bash
❯ civo database backups ls postgres-demo
❯ civo database backups ls mysql-demo
```

## PostgreSQL

> **Note:** PostgreSQL 14 is deprecated and will be removed in a future release. Please migrate to PostgreSQL 17. For migration guidance, see: https://www.civo.com/docs/database/postgresql/migrate-from-14-to-17

### Create Scheduled Backup

```bash
Expand Down Expand Up @@ -127,7 +121,7 @@ Warning: Are you sure you want to restore db postgres-demo from 20240131-095615F
Restoring database postgres-demo from from backup 20240131-095615F
```

## MySQL Backup
## MySQL Backup (Deprecated)

### Create

Expand Down
Loading