Struct database_schema::DatabaseSchemaBuilder
source · pub struct DatabaseSchemaBuilder(_);
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