All Projects → rust-db → Barrel

rust-db / Barrel

Licence: mit
🛢 A database schema migration builder for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Barrel

Go Sqlmock
Sql mock driver for golang to test database interactions
Stars: ✭ 4,003 (+876.34%)
Mutual labels:  sql, database
Jet
Type safe SQL builder with code generation and automatic query result data mapping
Stars: ✭ 373 (-9.02%)
Mutual labels:  sql, database
Lbadd
LBADD: An experimental, distributed SQL database
Stars: ✭ 362 (-11.71%)
Mutual labels:  sql, database
Freezer
A simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
Stars: ✭ 326 (-20.49%)
Mutual labels:  sql, database
Grdb.swift
A toolkit for SQLite databases, with a focus on application development
Stars: ✭ 4,637 (+1030.98%)
Mutual labels:  sql, database
Datafuse
Datafuse is a free Cloud-Native Analytics DBMS(Inspired by ClickHouse) implemented in Rust
Stars: ✭ 327 (-20.24%)
Mutual labels:  sql, database
Hive
Apache Hive
Stars: ✭ 4,031 (+883.17%)
Mutual labels:  sql, database
Ansible Role Postgresql
Ansible Role - PostgreSQL
Stars: ✭ 310 (-24.39%)
Mutual labels:  sql, database
Sqlhooks
Attach hooks to any database/sql driver
Stars: ✭ 397 (-3.17%)
Mutual labels:  sql, database
Pg timetable
pg_timetable: Advanced scheduling for PostgreSQL
Stars: ✭ 382 (-6.83%)
Mutual labels:  sql, database
Rel
💎 Modern Database Access Layer for Golang - Testable, Extendable and Crafted Into a Clean and Elegant API
Stars: ✭ 317 (-22.68%)
Mutual labels:  sql, database
Franchise
🍟 a notebook sql client. what you get when have a lot of sequels.
Stars: ✭ 3,823 (+832.44%)
Mutual labels:  sql, database
Monetdb Old
This is the official mirror of the MonetDB Mercurial repository. Please note that we do not accept pull requests on github. The regression test results can be found on the MonetDB Testweb http://monetdb.cwi.nl/testweb/web/status.php .For contributions please see: https://www.monetdb.org/Developers
Stars: ✭ 317 (-22.68%)
Mutual labels:  sql, database
Jupyterlab Sql
SQL GUI for JupyterLab
Stars: ✭ 336 (-18.05%)
Mutual labels:  sql, database
Php Sql Query Builder
An elegant lightweight and efficient SQL Query Builder with fluid interface SQL syntax supporting bindings and complicated query generation.
Stars: ✭ 313 (-23.66%)
Mutual labels:  sql, database
Hyrise
Hyrise is a research in-memory database.
Stars: ✭ 371 (-9.51%)
Mutual labels:  sql, database
Squeal
A Swift wrapper for SQLite databases
Stars: ✭ 303 (-26.1%)
Mutual labels:  sql, database
Squeal
Squeal, a deep embedding of SQL in Haskell
Stars: ✭ 308 (-24.88%)
Mutual labels:  sql, database
Dbeaver
Free universal database tool and SQL client
Stars: ✭ 23,752 (+5693.17%)
Mutual labels:  sql, database
Ignite
Apache Ignite
Stars: ✭ 4,027 (+882.2%)
Mutual labels:  sql, database

A powerful database schema builder, that lets you write your SQL migrations in Rust!

barrel offers callback-style builder functions for SQL migrations and is designed to be flexible, portable and fun to use. It provides you with a common interface over SQL, with additional database-specific builders.

This way you can focus on your Rust code, without having to worry about SQL.

Example

The following example will help you get started

use barrel::{types, Migration};
use barrel::backend::Pg;

fn main() {
    let mut m = Migration::new();

    m.create_table("users", |t| {
        t.add_column("name", types::varchar(255));
        t.add_column("age", types::integer());
        t.add_column("owns_plushy_sharks", types::boolean());
    });

    println!("{}", m.make::<Pg>());
}

Using Diesel

Since diesel 1.2.0 it's possible to now use barrel for migrations with diesel. A guide with some more information on how to get started can be found here

Migration guide

If you've been using barrel to write migrations for diesel before the 0.5.0 release, some migration of your migrations will be required. Since 0.5.0 the way types are constructed changed. Instead of constructing a type with Types::VarChar(255) (an enum variant), the types are now provided by a module called types and builder functions. The same type would now be types::varchar(255) (a function call), which then returns a Type enum.

You can also directly created your own Type builders this way. Check the docs for details!

License

barrel is free software: you can redistribute it and/or modify it under the terms of the MIT Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MIT Public License for more details.

Conduct

In the interest of fostering an open and welcoming environment, the barrel project pledges to making participation a harassment-free experience for everyone. See Code of Conduct for details. In case of violations, e-mail [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].