You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
600 B
29 lines
600 B
//! Simple schema representation for migration state
|
|
|
|
trait Schemas {
|
|
/// Returns the name of a database
|
|
fn name(&self) -> String;
|
|
|
|
/// Returns a list of all tables in a database
|
|
fn tables(&self) -> Vec<String>;
|
|
|
|
/// Returns a list of all column names and types
|
|
fn columns(&self, table: &str) -> Vec<(String, Column)>;
|
|
}
|
|
|
|
trait Column {
|
|
/// Get the type of column in SQL specific terms
|
|
fn type(&self) -> String;
|
|
}
|
|
|
|
// Describe the current state of a database to apply a migration to
|
|
struct Schema {
|
|
db_name: String,
|
|
columns: Vec<String>,
|
|
}
|
|
|
|
|
|
impl Schema {
|
|
|
|
}
|
|
|
|
|