lxd/db/node/update.go
func updateFromV37(tx *sql.Tx) error {
	count, err := query.Count(tx, "raft_nodes", "")
	if err != nil {
		return errors.Wrap(err, "Fetch count of Raft nodes")
	}

	if count == 0 {
		// This node is not clustered, nothing to do.
		return nil
	}

	// Copy the core.https_address config.
	_, err = tx.Exec(`
INSERT INTO config (key, value)
  SELECT 'cluster.https_address', value FROM config WHERE key = 'core.https_address'
`)
	if err != nil {
		return errors.Wrap(err, "Insert cluster.https_address config")
	}

	return nil
}
func updateFromV37(tx *sql.Tx) error {
	count, err := query.Count(tx, "raft_nodes", "")
	if err != nil {
		return errors.Wrap(err, "Fetch count of Raft nodes")
	}

	if count == 0 {
		// This node is not clustered, nothing to do.
		return nil
	}

	// Copy the core.https_address config.
	_, err = tx.Exec(`
INSERT INTO config (key, value)
  SELECT 'cluster.https_address', value FROM config WHERE key = 'core.https_address'
`)
	if err != nil {
		return errors.Wrap(err, "Insert cluster.https_address config")
	}

	return nil
}
// Schema updates begin here
// Copy core.https_address to cluster.https_address in case this node is
// clustered.