Skip to content

Commit

Permalink
Merge pull request #1 from zcash/rename-to-schemerz
Browse files Browse the repository at this point in the history
Rename to `schemerz`
  • Loading branch information
str4d authored Oct 15, 2024
2 parents 1bfd952 + 96fc346 commit 5a58a42
Show file tree
Hide file tree
Showing 20 changed files with 153 additions and 192 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,3 @@ jobs:
- uses: Swatinem/rust-cache@v1
- run: cargo build --tests
- run: cargo test -- --nocapture --quiet

publish-schemer:
uses: aschampion/gh-actions/.github/workflows/rust-publish.yml@v0
needs: [test, lint]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/schemer-v')
secrets: inherit
with:
working-directory: schemer
tag-prefix: schemer

publish-schemer-postgres:
uses: aschampion/gh-actions/.github/workflows/rust-publish.yml@v0
needs: [test, lint]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/schemer-postgres-v')
secrets: inherit
with:
working-directory: schemer-postgres
tag-prefix: schemer-postgres

publish-schemer-rusqlite:
uses: aschampion/gh-actions/.github/workflows/rust-publish.yml@v0
needs: [test, lint]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/schemer-rusqlite-v')
secrets: inherit
with:
working-directory: schemer-rusqlite
tag-prefix: schemer-rusqlite
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"
members = [
"schemer",
"schemer-postgres",
"schemer-rusqlite",
"schemerz",
"schemerz-postgres",
"schemerz-rusqlite",
]
3 changes: 2 additions & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2017 Andrew S. Champion
Copyright (c) 2024 The Electric Coin Company
Copyright (c) 2017-2024 Andrew S. Champion

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Schemer [![Build Status](https://github.com/aschampion/schemer/actions/workflows/ci.yml/badge.svg)](https://github.com/aschampion/schemer/actions/workflows/ci.yml/)
# Schemerz [![Build Status](https://github.com/zcash/schemerz/actions/workflows/ci.yml/badge.svg)](https://github.com/zcash/schemerz/actions/workflows/ci.yml/)

Schemer is a database schema migration library for Rust that supports directed acyclic graph (DAG) dependencies between migrations. It currently has adapters for the following databases:
Schemerz is a database schema migration library for Rust that supports directed acyclic graph (DAG) dependencies between migrations. It currently has adapters for the following databases:

- PostgreSQL: [schemer-postgres](https://crates.io/crates/schemer-postgres)
- SQLite: [schemer-rusqlite](https://crates.io/crates/schemer-rusqlite)
- PostgreSQL: [schemerz-postgres](https://crates.io/crates/schemerz-postgres)
- SQLite: [schemerz-rusqlite](https://crates.io/crates/schemerz-rusqlite)

Other Rust schema migration libraries to consider if you do not require DAG migration dependencies:

- [schemamama](https://crates.io/crates/schemamama) (recommended -- this is the basis for Schemer's API)
- [schemamama](https://crates.io/crates/schemamama) (recommended -- this is the basis for Schemerz's API)
- [dbmigrate](https://crates.io/crates/dbmigrate)
- [migrant](https://crates.io/crates/migrant)

Expand All @@ -19,6 +19,12 @@ Version bumping (including changelog release section versioning) is handled by [
cargo release --workspace minor
```

## Acknowledgements

Schemerz started as a fork of the [`schemer`](https://crates.io/crates/schemer) crate by
Andrew Champion. The name "Schemerz" is a nod to its origin, as well as a play on the
German word "Schmerz" meaning "pain" (which aptly describes database migrations).

## License

Licensed under either of
Expand Down
2 changes: 1 addition & 1 deletion release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pre-release-replacements = [
{file="CHANGELOG.md", search="\\[Unreleased\\]", replace="[{{version}}]", min=1},
{file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1},
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased]\n\n", exactly=1},
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/aschampion/schemer/compare/{{tag_name}}...HEAD", exactly=1},
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/zcash/schemerz/compare/{{tag_name}}...HEAD", exactly=1},
]
21 changes: 0 additions & 21 deletions schemer-postgres/CHANGELOG.md

This file was deleted.

18 changes: 0 additions & 18 deletions schemer-postgres/Cargo.toml

This file was deleted.

31 changes: 0 additions & 31 deletions schemer-rusqlite/CHANGELOG.md

This file was deleted.

18 changes: 0 additions & 18 deletions schemer-rusqlite/Cargo.toml

This file was deleted.

26 changes: 0 additions & 26 deletions schemer/CHANGELOG.md

This file was deleted.

18 changes: 18 additions & 0 deletions schemerz-postgres/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).


<!-- next-header -->
## [Unreleased]

## [0.190.0] - 2024-10-15
Initial release. The API is identical to `schemer-postgres 0.2.0`.


<!-- next-url -->
[Unreleased]: https://github.com/zcash/schemerz/compare/schemerz-postgres-0.1.0...HEAD
[0.190.0]: https://github.com/zcash/schemerz/compare/1bfd952b035b87a39df955376e0bdddf98eb6c99...schemerz-postgres-0.1.0
21 changes: 21 additions & 0 deletions schemerz-postgres/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "schemerz-postgres"
version = "0.190.0"
edition = "2021"
rust-version = "1.59"
authors = [
"Jack Grigg <[email protected]>",
"Kris Nuttycombe <[email protected]>",
]
description = "PostgreSQL adapter for the Schemerz database schema migration library"
readme = "../README.md"
keywords = ["database", "migration", "postgresql", "sql"]
categories = ["database"]
license = "MIT/Apache-2.0"
repository = "https://github.com/zcash/schemerz"

[dependencies]
postgres = { version = "0.19", features = ["with-uuid-1"] }
uuid = { version = "1" }

schemerz = { version = "0.1", path = "../schemerz" }
28 changes: 14 additions & 14 deletions schemer-postgres/src/lib.rs → schemerz-postgres/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
//! An adapter enabling use of the schemer schema migration library with
//! An adapter enabling use of the schemerz schema migration library with
//! PostgreSQL.
//!
//! # Examples:
//!
//! ```rust
//! extern crate postgres;
//! #[macro_use]
//! extern crate schemer;
//! extern crate schemer_postgres;
//! extern crate schemerz;
//! extern crate schemerz_postgres;
//! extern crate uuid;
//!
//! use std::collections::HashSet;
//!
//! use postgres::{Client, NoTls, Transaction};
//! use schemer::{Migration, Migrator};
//! use schemer_postgres::{PostgresAdapter, PostgresAdapterError, PostgresMigration};
//! use schemerz::{Migration, Migrator};
//! use schemerz_postgres::{PostgresAdapter, PostgresAdapterError, PostgresMigration};
//! use uuid::Uuid;
//!
//! struct MyExampleMigration;
Expand Down Expand Up @@ -58,7 +58,7 @@ use std::collections::HashSet;
use postgres::{Client, Error as PostgresError, Transaction};
use uuid::Uuid;

use schemer::{Adapter, Migration};
use schemerz::{Adapter, Migration};

/// PostgreSQL-specific trait for schema migrations.
pub trait PostgresMigration: Migration {
Expand All @@ -75,28 +75,28 @@ pub trait PostgresMigration: Migration {

pub type PostgresAdapterError = PostgresError;

/// Adapter between schemer and PostgreSQL.
/// Adapter between schemerz and PostgreSQL.
pub struct PostgresAdapter<'a> {
conn: &'a mut Client,
migration_metadata_table: String,
}

impl<'a> PostgresAdapter<'a> {
/// Construct a PostgreSQL schemer adapter.
/// Construct a PostgreSQL schemerz adapter.
///
/// `table_name` specifies the name of the table that schemer will use
/// `table_name` specifies the name of the table that schemerz will use
/// for storing metadata about applied migrations. If `None`, a default
/// will be used.
///
/// ```rust
/// # extern crate postgres;
/// # extern crate schemer_postgres;
/// # extern crate schemerz_postgres;
/// #
/// # fn main() {
/// let mut conn = postgres::Client::connect(
/// "postgresql://postgres@localhost",
/// postgres::NoTls).unwrap();
/// let adapter = schemer_postgres::PostgresAdapter::new(&mut conn, None);
/// let adapter = schemerz_postgres::PostgresAdapter::new(&mut conn, None);
/// # }
/// ```
pub fn new(conn: &'a mut Client, table_name: Option<String>) -> PostgresAdapter<'a> {
Expand All @@ -106,7 +106,7 @@ impl<'a> PostgresAdapter<'a> {
}
}

/// Initialize the schemer metadata schema. This must be called before
/// Initialize the schemerz metadata schema. This must be called before
/// using `Migrator` with this adapter. This is safe to call multiple times.
pub fn init(&mut self) -> Result<(), PostgresError> {
self.conn.execute(
Expand Down Expand Up @@ -173,8 +173,8 @@ impl<'a> Adapter for PostgresAdapter<'a> {
mod tests {
use super::*;
use postgres::NoTls;
use schemer::test_schemer_adapter;
use schemer::testing::*;
use schemerz::test_schemer_adapter;
use schemerz::testing::*;

impl PostgresMigration for TestMigration {}

Expand Down
18 changes: 18 additions & 0 deletions schemerz-rusqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).


<!-- next-header -->
## [Unreleased]

## [0.290.0] - 2024-10-15
Initial release. The API is identical to `schemer-rusqlite 0.2.2`.


<!-- next-url -->
[Unreleased]: https://github.com/zcash/schemerz/compare/schemerz-rusqlite-0.1.0...HEAD
[0.290.0]: https://github.com/zcash/schemerz/compare/1bfd952b035b87a39df955376e0bdddf98eb6c99...schemerz-rusqlite-0.1.0
21 changes: 21 additions & 0 deletions schemerz-rusqlite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "schemerz-rusqlite"
version = "0.290.0"
edition = "2021"
rust-version = "1.59"
authors = [
"Jack Grigg <[email protected]>",
"Kris Nuttycombe <[email protected]>",
]
description = "SQLite3 adapter for the Schemerz database schema migration library "
readme = "../README.md"
keywords = ["database", "migration", "sqlite", "sql"]
categories = ["database"]
license = "MIT/Apache-2.0"
repository = "https://github.com/zcash/schemerz"

[dependencies]
uuid = { version = "1" }
rusqlite = "0.29.0"

schemerz = { version = "0.1", path = "../schemerz" }
Loading

0 comments on commit 5a58a42

Please sign in to comment.