Merge branch 'next/minor' of github.com:Start9Labs/start-os into next/major

This commit is contained in:
Matt Hill
2024-08-08 10:52:49 -06:00
765 changed files with 43858 additions and 19423 deletions

View File

@@ -5,44 +5,68 @@ use futures::future::BoxFuture;
use futures::{Future, FutureExt};
use imbl_value::InternedString;
use crate::db::model::Database;
use crate::prelude::*;
use crate::progress::PhaseProgressTrackerHandle;
use crate::Error;
mod v0_3_5;
mod v0_3_5_1;
mod v0_3_5_2;
mod v0_3_6;
mod v0_3_6_alpha_0;
mod v0_3_6_alpha_1;
mod v0_3_6_alpha_2;
mod v0_3_6_alpha_3;
mod v0_3_6_alpha_4;
mod v0_3_6_alpha_5;
mod v0_3_6_alpha_6;
mod v0_3_6_alpha_7;
pub type Current = v0_3_6::Version;
pub type Current = v0_3_6_alpha_3::Version; // VERSION_BUMP
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(untagged)]
#[allow(non_camel_case_types)]
enum Version {
LT0_3_5(LTWrapper<v0_3_5::Version>),
V0_3_5(Wrapper<v0_3_5::Version>),
V0_3_5_1(Wrapper<v0_3_5_1::Version>),
V0_3_5_2(Wrapper<v0_3_5_2::Version>),
V0_3_6(Wrapper<v0_3_6::Version>),
Other(emver::Version),
V0_3_6_alpha_0(Wrapper<v0_3_6_alpha_0::Version>),
V0_3_6_alpha_1(Wrapper<v0_3_6_alpha_1::Version>),
V0_3_6_alpha_2(Wrapper<v0_3_6_alpha_2::Version>),
V0_3_6_alpha_3(Wrapper<v0_3_6_alpha_3::Version>),
V0_3_6_alpha_4(Wrapper<v0_3_6_alpha_4::Version>),
V0_3_6_alpha_5(Wrapper<v0_3_6_alpha_5::Version>),
V0_3_6_alpha_6(Wrapper<v0_3_6_alpha_6::Version>),
V0_3_6_alpha_7(Wrapper<v0_3_6_alpha_7::Version>),
Other(exver::Version),
}
impl Version {
fn from_util_version(version: crate::util::Version) -> Self {
fn from_exver_version(version: exver::Version) -> Self {
serde_json::to_value(version.clone())
.and_then(serde_json::from_value)
.unwrap_or_else(|_e| {
tracing::warn!("Can't deserialize: {:?} and falling back to other", version);
Version::Other(version.into_version())
Version::Other(version)
})
}
#[cfg(test)]
fn as_sem_ver(&self) -> emver::Version {
fn as_exver(&self) -> exver::Version {
match self {
Version::LT0_3_5(LTWrapper(_, x)) => x.clone(),
Version::V0_3_5(Wrapper(x)) => x.semver(),
Version::V0_3_5_1(Wrapper(x)) => x.semver(),
Version::V0_3_5_2(Wrapper(x)) => x.semver(),
Version::V0_3_6(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_0(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_1(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_2(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_3(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_4(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_5(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_6(Wrapper(x)) => x.semver(),
Version::V0_3_6_alpha_7(Wrapper(x)) => x.semver(),
Version::Other(x) => x.clone(),
}
}
@@ -54,11 +78,14 @@ where
{
type Previous: VersionT;
fn new() -> Self;
fn semver(&self) -> emver::Version;
fn compat(&self) -> &'static emver::VersionRange;
fn up(&self, db: &PatchDb) -> impl Future<Output = Result<(), Error>> + Send;
fn down(&self, db: &PatchDb) -> impl Future<Output = Result<(), Error>> + Send;
fn commit(&self, db: &PatchDb) -> impl Future<Output = Result<(), Error>> + Send {
fn semver(&self) -> exver::Version;
fn compat(&self) -> &'static exver::VersionRange;
fn up(&self, db: &TypedPatchDb<Database>) -> impl Future<Output = Result<(), Error>> + Send;
fn down(&self, db: &TypedPatchDb<Database>) -> impl Future<Output = Result<(), Error>> + Send;
fn commit(
&self,
db: &TypedPatchDb<Database>,
) -> impl Future<Output = Result<(), Error>> + Send {
async {
let semver = self.semver().into();
let compat = self.compat().clone();
@@ -80,12 +107,13 @@ where
fn migrate_to<V: VersionT>(
&self,
version: &V,
db: &PatchDb,
db: &TypedPatchDb<Database>,
progress: &mut PhaseProgressTrackerHandle,
) -> impl Future<Output = Result<(), Error>> + Send {
async {
match self.semver().cmp(&version.semver()) {
Ordering::Greater => self.rollback_to_unchecked(version, db).await,
Ordering::Less => version.migrate_from_unchecked(self, db).await,
Ordering::Greater => self.rollback_to_unchecked(version, db, progress).await,
Ordering::Less => version.migrate_from_unchecked(self, db, progress).await,
Ordering::Equal => Ok(()),
}
}
@@ -93,12 +121,16 @@ where
fn migrate_from_unchecked<'a, V: VersionT>(
&'a self,
version: &'a V,
db: &'a PatchDb,
db: &'a TypedPatchDb<Database>,
progress: &'a mut PhaseProgressTrackerHandle,
) -> BoxFuture<'a, Result<(), Error>> {
progress.add_total(1);
async {
let previous = Self::Previous::new();
if version.semver() < previous.semver() {
previous.migrate_from_unchecked(version, db).await?;
previous
.migrate_from_unchecked(version, db, progress)
.await?;
} else if version.semver() > previous.semver() {
return Err(Error::new(
eyre!(
@@ -111,6 +143,7 @@ where
tracing::info!("{} -> {}", previous.semver(), self.semver(),);
self.up(db).await?;
self.commit(db).await?;
*progress += 1;
Ok(())
}
.boxed()
@@ -118,15 +151,19 @@ where
fn rollback_to_unchecked<'a, V: VersionT>(
&'a self,
version: &'a V,
db: &'a PatchDb,
db: &'a TypedPatchDb<Database>,
progress: &'a mut PhaseProgressTrackerHandle,
) -> BoxFuture<'a, Result<(), Error>> {
async {
let previous = Self::Previous::new();
tracing::info!("{} -> {}", self.semver(), previous.semver(),);
self.down(db).await?;
previous.commit(db).await?;
*progress += 1;
if version.semver() < previous.semver() {
previous.rollback_to_unchecked(version, db).await?;
previous
.rollback_to_unchecked(version, db, progress)
.await?;
} else if version.semver() > previous.semver() {
return Err(Error::new(
eyre!(
@@ -143,7 +180,7 @@ where
}
#[derive(Debug, Clone)]
struct LTWrapper<T>(T, emver::Version);
struct LTWrapper<T>(T, exver::Version);
impl<T> serde::Serialize for LTWrapper<T>
where
T: VersionT,
@@ -157,10 +194,10 @@ where
T: VersionT,
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let v = crate::util::Version::deserialize(deserializer)?;
let v = exver::Version::deserialize(deserializer)?;
let version = T::new();
if *v < version.semver() {
Ok(Self(version, v.into_version()))
if v < version.semver() {
Ok(Self(version, v))
} else {
Err(serde::de::Error::custom("Mismatched Version"))
}
@@ -182,9 +219,9 @@ where
T: VersionT,
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let v = crate::util::Version::deserialize(deserializer)?;
let v = exver::Version::deserialize(deserializer)?;
let version = T::new();
if *v == version.semver() {
if v == version.semver() {
Ok(Wrapper(version))
} else {
Err(serde::de::Error::custom("Mismatched Version"))
@@ -192,8 +229,25 @@ where
}
}
pub async fn init(db: &PatchDb) -> Result<(), Error> {
let version = Version::from_util_version(
pub async fn init(
db: &TypedPatchDb<Database>,
mut progress: PhaseProgressTrackerHandle,
) -> Result<(), Error> {
progress.start();
db.mutate(|db| {
db.as_public_mut()
.as_server_info_mut()
.as_version_mut()
.map_mutate(|v| {
Ok(if v == exver::Version::new([0, 3, 6], []) {
v0_3_6_alpha_0::Version::new().semver()
} else {
v
})
})
})
.await?; // TODO: remove before releasing 0.3.6
let version = Version::from_exver_version(
db.peek()
.await
.as_public()
@@ -209,10 +263,17 @@ pub async fn init(db: &PatchDb) -> Result<(), Error> {
ErrorKind::MigrationFailed,
));
}
Version::V0_3_5(v) => v.0.migrate_to(&Current::new(), &db).await?,
Version::V0_3_5_1(v) => v.0.migrate_to(&Current::new(), &db).await?,
Version::V0_3_5_2(v) => v.0.migrate_to(&Current::new(), &db).await?,
Version::V0_3_6(v) => v.0.migrate_to(&Current::new(), &db).await?,
Version::V0_3_5(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_5_1(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_5_2(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_0(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_1(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_2(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_3(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_4(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_5(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_6(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::V0_3_6_alpha_7(v) => v.0.migrate_to(&Current::new(), &db, &mut progress).await?,
Version::Other(_) => {
return Err(Error::new(
eyre!("Cannot downgrade"),
@@ -220,6 +281,7 @@ pub async fn init(db: &PatchDb) -> Result<(), Error> {
))
}
}
progress.complete();
Ok(())
}
@@ -236,9 +298,18 @@ mod tests {
use super::*;
fn em_version() -> impl Strategy<Value = emver::Version> {
any::<(usize, usize, usize, usize)>().prop_map(|(major, minor, patch, super_minor)| {
emver::Version::new(major, minor, patch, super_minor)
fn em_version() -> impl Strategy<Value = exver::Version> {
any::<(usize, usize, usize, bool)>().prop_map(|(major, minor, patch, alpha)| {
if alpha {
exver::Version::new(
[0, major, minor]
.into_iter()
.chain(Some(patch).filter(|n| *n != 0)),
[],
)
} else {
exver::Version::new([major, minor, patch], [])
}
})
}
@@ -247,21 +318,30 @@ mod tests {
Just(Version::V0_3_5(Wrapper(v0_3_5::Version::new()))),
Just(Version::V0_3_5_1(Wrapper(v0_3_5_1::Version::new()))),
Just(Version::V0_3_5_2(Wrapper(v0_3_5_2::Version::new()))),
Just(Version::V0_3_6_alpha_0(Wrapper(
v0_3_6_alpha_0::Version::new()
))),
Just(Version::V0_3_6_alpha_1(Wrapper(
v0_3_6_alpha_1::Version::new()
))),
Just(Version::V0_3_6_alpha_2(Wrapper(
v0_3_6_alpha_2::Version::new()
))),
em_version().prop_map(Version::Other),
]
}
proptest! {
#[test]
fn emversion_isomorphic_version(original in em_version()) {
let version = Version::from_util_version(original.clone().into());
let back = version.as_sem_ver();
fn exversion_isomorphic_version(original in em_version()) {
let version = Version::from_exver_version(original.clone().into());
let back = version.as_exver();
prop_assert_eq!(original, back, "All versions should round trip");
}
#[test]
fn version_isomorphic_em_version(version in versions()) {
let sem_ver = version.as_sem_ver();
let back = Version::from_util_version(sem_ver.into());
let sem_ver = version.as_exver();
let back = Version::from_exver_version(sem_ver.into());
prop_assert_eq!(format!("{:?}",version), format!("{:?}", back), "All versions should round trip");
}
}

View File

@@ -1,21 +1,30 @@
use emver::VersionRange;
use exver::{ExtendedVersion, VersionRange};
use super::VersionT;
use crate::db::model::Database;
use crate::prelude::*;
use crate::version::Current;
lazy_static::lazy_static! {
pub static ref V0_3_0_COMPAT: VersionRange = VersionRange::Conj(
Box::new(VersionRange::Anchor(
emver::GTE,
emver::Version::new(0, 3, 0, 0),
)),
Box::new(VersionRange::Anchor(emver::LTE, Current::new().semver())),
pub static ref V0_3_0_COMPAT: VersionRange = VersionRange::and(
VersionRange::anchor(
exver::GTE,
ExtendedVersion::new(
exver::Version::new([0, 3, 0], []),
exver::Version::default(),
),
),
VersionRange::anchor(
exver::LTE,
ExtendedVersion::new(
Current::new().semver(),
exver::Version::default(),
)
),
);
static ref V0_3_5: exver::Version = exver::Version::new([0, 3, 5], []);
}
const V0_3_5: emver::Version = emver::Version::new(0, 3, 5, 0);
#[derive(Clone, Debug)]
pub struct Version;
@@ -24,16 +33,16 @@ impl VersionT for Version {
fn new() -> Self {
Version
}
fn semver(&self) -> emver::Version {
V0_3_5
fn semver(&self) -> exver::Version {
V0_3_5.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -1,10 +1,13 @@
use emver::VersionRange;
use exver::VersionRange;
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_5, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
const V0_3_5_1: emver::Version = emver::Version::new(0, 3, 5, 1);
lazy_static::lazy_static! {
static ref V0_3_5_1: exver::Version = exver::Version::new([0, 3, 5, 1], []);
}
#[derive(Clone, Debug)]
pub struct Version;
@@ -14,16 +17,16 @@ impl VersionT for Version {
fn new() -> Self {
Version
}
fn semver(&self) -> emver::Version {
V0_3_5_1
fn semver(&self) -> exver::Version {
V0_3_5_1.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -1,10 +1,13 @@
use emver::VersionRange;
use exver::VersionRange;
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_5_1, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
const V0_3_5_2: emver::Version = emver::Version::new(0, 3, 5, 2);
lazy_static::lazy_static! {
static ref V0_3_5_2: exver::Version = exver::Version::new([0, 3, 5, 2], []);
}
#[derive(Clone, Debug)]
pub struct Version;
@@ -14,16 +17,16 @@ impl VersionT for Version {
fn new() -> Self {
Version
}
fn semver(&self) -> emver::Version {
V0_3_5_2
fn semver(&self) -> exver::Version {
V0_3_5_2.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -1,29 +0,0 @@
use emver::VersionRange;
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_5_1, VersionT};
use crate::prelude::*;
const V0_3_6: emver::Version = emver::Version::new(0, 3, 6, 0);
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_5_1::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> emver::Version {
V0_3_6
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
Err(Error::new(eyre!("unimplemented"), ErrorKind::Unknown))
}
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_5_2, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_0: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 0.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_5_2::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_0.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Err(Error::new(eyre!("unimplemented"), ErrorKind::Unknown))
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_6_alpha_0, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_1: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 1.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_6_alpha_0::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_1.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_6_alpha_1, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_2: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 2.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_6_alpha_1::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_2.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_6_alpha_2, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_3: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 3.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_6_alpha_2::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_3.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_6_alpha_3, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_4: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 4.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_6_alpha_3::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_4.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_6_alpha_4, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_5: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 5.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_6_alpha_4::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_5.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_6_alpha_5, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_6: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 6.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_6_alpha_5::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_6.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}

View File

@@ -0,0 +1,35 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_3_6_alpha_6, VersionT};
use crate::db::model::Database;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_3_6_alpha_7: exver::Version = exver::Version::new(
[0, 3, 6],
[PreReleaseSegment::String("alpha".into()), 7.into()]
);
}
#[derive(Clone, Debug)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_3_6_alpha_6::Version;
fn new() -> Self {
Version
}
fn semver(&self) -> exver::Version {
V0_3_6_alpha_7.clone()
}
fn compat(&self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
Ok(())
}
}