pub struct DatabaseSchemaBuilder(/* private fields */);
Expand description
Builder for DatabaseSchema
Implementations§
Source§impl DatabaseSchemaBuilder
impl DatabaseSchemaBuilder
Sourcepub fn connection_url<S: Into<String>>(
&mut self,
connection_url: S,
) -> &mut Self
pub fn connection_url<S: Into<String>>( &mut self, connection_url: S, ) -> &mut Self
This is the connection URL used to connect to the database.
For mysql
and postgres
this is the same URL you would pass to the connect
method of the client.
-
mysql
:mysql://[user[:password]@]host/database_name[?unix_socket=socket-path&ssl_mode=SSL_MODE*&ssl_ca=/etc/ssl/certs/ca-certificates.crt&ssl_cert=/etc/ssl/certs/client-cert.crt&ssl_key=/etc/ssl/certs/client-key.crt]
-
postgres
:postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]
- you can read more at libpq docs -
sqlite
:sqlite::memory:
in the case ofsqlx
and:memory:
in the case ofdiesel
- you don’t need to set this forsqlite
as we auto-detect it as long as you enable thesqlite
feature.
Sourcepub fn migrations_dir<P: AsRef<Path>>(
&mut self,
migrations_dir: P,
) -> Result<&mut Self, Error>
pub fn migrations_dir<P: AsRef<Path>>( &mut self, migrations_dir: P, ) -> Result<&mut Self, Error>
Set migrations_dir
- this is the directory path where your migrations are stored.
By default we assume that the migrations are stored in the migrations
directory
starting at the root of your project.
We call canonicalize()
on the path, so you can pass in a relative path. The
downside is that this call can fail.
Sourcepub fn destination_path<P: AsRef<Path>>(
&mut self,
destination_path: P,
) -> &mut Self
pub fn destination_path<P: AsRef<Path>>( &mut self, destination_path: P, ) -> &mut Self
Set destination_path
- this is the path to the file where we’ll store the SQL dump.
By default we assume structure.sql
in the root of your project.
Sourcepub fn build(&self) -> DatabaseSchema
pub fn build(&self) -> DatabaseSchema
Build DatabaseSchema
from DatabaseSchemaBuilder
Trait Implementations§
Source§impl Debug for DatabaseSchemaBuilder
impl Debug for DatabaseSchemaBuilder
Source§impl Default for DatabaseSchemaBuilder
impl Default for DatabaseSchemaBuilder
Source§fn default() -> DatabaseSchemaBuilder
fn default() -> DatabaseSchemaBuilder
Auto Trait Implementations§
impl Freeze for DatabaseSchemaBuilder
impl RefUnwindSafe for DatabaseSchemaBuilder
impl Send for DatabaseSchemaBuilder
impl Sync for DatabaseSchemaBuilder
impl Unpin for DatabaseSchemaBuilder
impl UnwindSafe for DatabaseSchemaBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more