Skip to main content

mz_mysql_util/
schema_change.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10//! Upstream schema changes that Materialize cannot follow.
11
12use serde::{Deserialize, Serialize};
13
14pub use mz_source_schema_change::{KeyRef, SchemaChange};
15
16/// A [`SchemaChange`] on a MySQL table.
17#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, thiserror::Error)]
18#[error("incompatible schema change on {schema_name}.{name}: {change}")]
19pub struct SchemaChangeError {
20    pub schema_name: String,
21    pub name: String,
22    pub change: SchemaChange,
23}
24
25impl SchemaChangeError {
26    pub fn hint(&self) -> Option<String> {
27        self.change.hint(&self.schema_name, &self.name)
28    }
29}