Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upDocument using in-memory SQLite databases #419
Comments
This comment has been minimized.
|
Using an in memory database is certainly supported, but you not be able to use |
This comment has been minimized.
|
You can run migrations against the database after establishing the connection using the embed_migrations!();
fn establish_connection() -> Result<SqliteConnection, MigrationError> {
let connection = try!(SqliteConnection::establish(":memory:"));
try!(embedded_migrations::run(&connection).unwrap();
Ok(connection)
} |
sgrif
closed this
Aug 27, 2016
This comment has been minimized.
Thomasdezeeuw
commented
Apr 28, 2017
|
@sgrif your example helps a lot to understanding the |
This comment has been minimized.
This comment has been minimized.
Thomasdezeeuw
commented
Apr 28, 2017
|
I didn't see that, I was using local (outdated) documentation. Great that it's in! |
pop commentedAug 27, 2016
•
edited
I'm trying to use diesel with SQLite. For testing purposes it'd be great to setup and teardown
":memory:"databases but there's not really any documentation on how to do this.I'd love to write the docs if someone could explain how I'm supposed to A) setup a connection with a
":memory:"database and B) Run migrations on that database. Preferably without also having manually setup a file-based SQLite database.I really like diesel and would love to contribute.
Edit:
I'm aware that I can just run
SqliteConnection::establish(":memory:").unwrap()to get an in-memory SQLite connection. What I'm really curious about is how to compile a program using diesel without a previously existing database and not getting error output likeEither way I'm up for documenting this, it took a bit of digging to get as far as I have.