lxd/db/raft.go
func (n *NodeTx) RaftNodeFirst(address string) error {
	columns := []string{"id", "address"}
	values := []interface{}{int64(1), address}
	id, err := query.UpsertObject(n.tx, "raft_nodes", columns, values)
	if err != nil {
		return err
	}
	if id != 1 {
		return fmt.Errorf("could not set raft node ID to 1")
	}
	return nil
}
func (n *NodeTx) RaftNodeFirst(address string) error {
	columns := []string{"id", "address"}
	values := []interface{}{int64(1), address}
	id, err := query.UpsertObject(n.tx, "raft_nodes", columns, values)
	if err != nil {
		return err
	}
	if id != 1 {
		return fmt.Errorf("could not set raft node ID to 1")
	}
	return nil
}
// RaftNodeFirst adds a the first node of the cluster. It ensures that the
// database ID is 1, to match the server ID of first raft log entry.
//
// This method is supposed to be called when there are no rows in raft_nodes,
// and it will replace whatever existing row has ID 1.