fly/
migration.rs

1use std::{cmp::Ordering, time::SystemTime};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct Migration {
5    pub up_sql: String,
6    pub down_sql: String,
7    pub name: String,
8}
9
10impl PartialOrd for Migration {
11    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
12        Some(self.name.cmp(&other.name))
13    }
14}
15
16impl Ord for Migration {
17    fn cmp(&self, other: &Self) -> Ordering {
18        self.name.cmp(&other.name)
19    }
20}
21
22#[derive(Debug, Clone, PartialEq, Eq)]
23pub struct MigrationMeta {
24    pub id: i32,
25    pub created_at: SystemTime,
26}
27
28#[derive(Debug, Clone, PartialEq, Eq)]
29pub struct MigrationWithMeta {
30    pub migration: Migration,
31    pub meta: MigrationMeta,
32}