Skip to content

Commit 825a980

Browse files
feat: derive Serialize for Migration if serde is enabled (#395)
* feat: derive Serialize for Migration if serde is enabled * time/serde dep feature * ci
1 parent b7c8d44 commit 825a980

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

refinery_core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ default = []
1313
mysql_async = ["dep:mysql_async"]
1414
postgres = ["dep:postgres", "dep:postgres-native-tls", "dep:native-tls"]
1515
rusqlite-bundled = ["rusqlite", "rusqlite/bundled"]
16-
serde = ["dep:serde"]
16+
serde = ["dep:serde", "time/serde"]
1717
tiberius = ["dep:tiberius", "futures", "tokio", "tokio/net"]
1818
tiberius-config = ["tiberius", "tokio", "tokio-util", "serde"]
1919
tokio-postgres = ["dep:postgres-native-tls", "dep:native-tls", "dep:tokio-postgres", "tokio", "tokio/rt"]

refinery_core/src/runner.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use std::fmt::Formatter;
1414

1515
/// An enum set that represents the type of the Migration
1616
#[derive(Clone, PartialEq)]
17+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1718
pub enum Type {
1819
Versioned,
1920
Unversioned,
@@ -51,6 +52,7 @@ pub enum Target {
5152
// an Enum set that represents the state of the migration: Applied on the database,
5253
// or Unapplied yet to be applied on the database
5354
#[derive(Clone, Debug)]
55+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5456
enum State {
5557
Applied,
5658
Unapplied,
@@ -62,6 +64,7 @@ enum State {
6264
///
6365
/// [`embed_migrations!`]: macro.embed_migrations.html
6466
#[derive(Clone, Debug)]
67+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6568
pub struct Migration {
6669
state: State,
6770
name: String,

0 commit comments

Comments
 (0)