-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
break refinery into refinery_core to remove code duplication (#70) cl…
…oses #58
- Loading branch information
Showing
32 changed files
with
152 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
members = [ | ||
"refinery", | ||
"refinery_cli", | ||
"refinery_core", | ||
"refinery_macros" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[package] | ||
name = "refinery-core" | ||
version = "0.2.0" | ||
authors = ["Katharina Fey <kookie@spacekookie.de>", "João Oliveira <hello@jxs.pt>"] | ||
description = "This crate should not be used directly, it is internaly related to Refinery" | ||
license = "MIT OR Apache-2.0" | ||
documentation = "https://docs.rs/refinery/" | ||
repository = "https://github.com/rust-db/refinery" | ||
edition = "2018" | ||
|
||
[features] | ||
default = [] | ||
rusqlite-bundled = ["rusqlite", "rusqlite/bundled"] | ||
|
||
[dependencies] | ||
lazy_static = "1" | ||
regex = "1" | ||
log = "0.4" | ||
chrono = "0.4" | ||
serde = { version = "1", features = ["derive"] } | ||
cfg-if = "0.1.10" | ||
thiserror = "1" | ||
async-trait = "0.1" | ||
toml = "0.5" | ||
siphasher = "0.3" | ||
walkdir = "2.3.1" | ||
|
||
rusqlite = {version = "0.21", optional = true} | ||
postgres = {version = "0.17", optional = true} | ||
mysql = {version = "17", optional = true} | ||
tokio-postgres = { version = "0.5", optional = true } | ||
mysql_async = { version = "0.21", optional = true } | ||
|
||
tokio = { version = "0.2", features = ["full"], optional = true } | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*! | ||
Powerful SQL migration toolkit for Rust. | ||
`refinery` makes running migrations for different databases as easy as possible. | ||
It works by running your migrations on a provided database connection, either by embedding them on your Rust code, or via `refinery_cli`.\ | ||
Currently, [`Postgres`](https://crates.io/crates/postgres), [`Rusqlite`](https://crates.io/crates/rusqlite), and [`Mysql`](https://crates.io/crates/mysql) are supported.\ | ||
`refinery` works best with [`Barrel`](https://crates.io/crates/barrel) but you can also have your migrations on .sql files or use any other Rust crate for schema generation. | ||
## Usage | ||
- Migrations can be defined in .sql files or Rust modules that must have a function called `migration()` that returns a [`std::string::String`] | ||
- Migrations, both .sql files and Rust modules must be named in the format `V{1}__{2}.rs ` where `{1}` represents the migration version and `{2}` the name. | ||
- Migrations can be run either by embedding them on your Rust code with [`embed_migrations!`] and [`include_migration_mods!`] macros, or via `refinery_cli`. | ||
[`embed_migrations!`]: macro.embed_migrations.html | ||
[`include_migration_mods!`]: macro.include_migration_mods.html | ||
### Example | ||
```rust,no_run | ||
use rusqlite::Connection; | ||
mod embedded { | ||
use refinery::embed_migrations; | ||
embed_migrations!("./tests/sql_migrations"); | ||
} | ||
let mut conn = Connection::open_in_memory().unwrap(); | ||
embedded::migrations::runner().run(&mut conn).unwrap(); | ||
``` | ||
for more examples refer to the [examples](https://github.com/rust-db/refinery/tree/master/examples) | ||
*/ | ||
|
||
pub mod config; | ||
mod drivers; | ||
mod error; | ||
mod runner; | ||
mod traits; | ||
mod util; | ||
|
||
pub use crate::error::Error; | ||
pub use crate::runner::{AppliedMigration, Migration, Runner}; | ||
pub use crate::traits::r#async::AsyncMigrate; | ||
pub use crate::traits::sync::Migrate; | ||
pub use crate::util::{find_migration_files, MigrationType}; | ||
|
||
#[cfg(feature = "rusqlite")] | ||
pub use rusqlite; | ||
|
||
#[cfg(feature = "postgres")] | ||
pub use postgres; | ||
|
||
#[cfg(feature = "mysql")] | ||
pub use mysql; | ||
|
||
#[cfg(feature = "tokio-postgres")] | ||
pub use tokio_postgres; | ||
|
||
#[cfg(feature = "mysql_async")] | ||
pub use mysql_async; | ||
|
||
#[cfg(feature = "tokio")] | ||
pub use tokio; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.