74
74
///
75
75
/// [dotenv]: https://crates.io/crates/dotenv
76
76
/// [dotenvy]: https://crates.io/crates/dotenvy
77
+ ///
78
+ /// ## Configuration with `sqlx.toml`
79
+ /// Multiple crate-wide configuration options are now available, including:
80
+ ///
81
+ /// * change the name of the `DATABASE_URL` variable for using multiple databases in the same workspace
82
+ /// * In the initial implementation, a separate crate must be created for each database.
83
+ /// Using multiple databases in the same crate may become possible in the future.
84
+ /// * global type overrides (useful for custom types!)
85
+ /// * per-column type overrides
86
+ /// * force use of a specific crate (e.g. `chrono` when both it and `time` are enabled)
87
+ ///
88
+ /// See the [configuration guide] and [reference `sqlx.toml`] for details.
89
+ ///
90
+ /// See also `examples/postgres/multi-database` and `examples/postgres/preferred-crates`
91
+ /// for example usage.
92
+ ///
93
+ /// [configuration guide]: crate::_config::macros::Config
94
+ /// [reference `sqlx.toml`]: crate::_config::_reference
95
+ ///
77
96
/// ## Query Arguments
78
97
/// Like `println!()` and the other formatting macros, you can add bind parameters to your SQL
79
98
/// and this macro will typecheck passed arguments and error on missing ones:
@@ -728,6 +747,7 @@ macro_rules! query_file_scalar_unchecked (
728
747
/// Embeds migrations into the binary by expanding to a static instance of [Migrator][crate::migrate::Migrator].
729
748
///
730
749
/// ```rust,ignore
750
+ /// // Consider instead setting
731
751
/// sqlx::migrate!("db/migrations")
732
752
/// .run(&pool)
733
753
/// .await?;
@@ -745,6 +765,38 @@ macro_rules! query_file_scalar_unchecked (
745
765
///
746
766
/// See [MigrationSource][crate::migrate::MigrationSource] for details on structure of the ./migrations directory.
747
767
///
768
+ /// ## Note: Platform-specific Line Endings
769
+ /// Different platforms use different bytes for line endings by default:
770
+ /// * Linux and MacOS use Line Feeds (LF:`\n`)
771
+ /// * Windows uses Carriage Returns _and_ Line Feeds (CRLF:'\r\n')
772
+ ///
773
+ /// This may result in un-reproducible hashes across platforms unless taken into account.
774
+ ///
775
+ /// One solution is to use a [`.gitattributes` file](https://git-scm.com/docs/gitattributes)
776
+ /// and force `.sql` files to be checked out with Line Feeds:
777
+ ///
778
+ /// ```gitattributes
779
+ /// *.sql text eol=lf
780
+ /// ```
781
+ ///
782
+ /// Another option is to configure migrations to ignore whitespace.
783
+ /// See the next section for details.
784
+ ///
785
+ /// ## Configuration with `sqlx.toml`
786
+ /// Multiple crate-wide configuration options are now available, including:
787
+ ///
788
+ /// * creating schemas on database setup
789
+ /// * renaming the `_sqlx_migrations` table or placing it into a new schema
790
+ /// * relocating the migrations directory
791
+ /// * ignoring characters for hashing (such as whitespace and newlines)
792
+ ///
793
+ /// See the [configuration guide] and [reference `sqlx.toml`] for details.
794
+ ///
795
+ /// `sqlx-cli` can also read these options and use them when setting up or migrating databases.
796
+ ///
797
+ /// [configuration guide]: crate::_config::migrate::Config
798
+ /// [reference `sqlx.toml`]: crate::_config::_reference
799
+ ///
748
800
/// ## Triggering Recompilation on Migration Changes
749
801
/// In some cases when making changes to embedded migrations, such as adding a new migration without
750
802
/// changing any Rust source files, you might find that `cargo build` doesn't actually do anything,
0 commit comments