Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure compatibility with 2021 edition by working around cargo featur… #2902

Merged
merged 1 commit into from Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -97,7 +97,7 @@ jobs:
brew services start mysql@5.7 &&
brew services stop mysql@5.7;sleep 3;brew services start mysql@5.7 &&
sleep 2 &&
/usr/local/Cellar/mysql@5.7/5.7.34/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot
/usr/local/Cellar/mysql@5.7/5.7.35/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot
echo 'MYSQL_DATABASE_URL=mysql://root@localhost/diesel_test' >> $GITHUB_ENV
echo 'MYSQL_EXAMPLE_DATABASE_URL=mysql://root@localhost/diesel_example' >> $GITHUB_ENV
echo 'MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@localhost/diesel_unit_test' >> $GITHUB_ENV
Expand Down
4 changes: 0 additions & 4 deletions diesel/src/query_builder/insert_statement/mod.rs
Expand Up @@ -202,10 +202,6 @@ where
}

#[cfg(feature = "sqlite")]
#[deprecated(
since = "1.2.0",
note = "Use `<&'a [U] as Insertable<T>>::Values` instead"
)]
impl<'a, T, U, Op> ExecuteDsl<SqliteConnection> for InsertStatement<T, &'a [U], Op>
where
&'a U: Insertable<T>,
Expand Down
76 changes: 38 additions & 38 deletions diesel/src/sql_types/mod.rs
Expand Up @@ -35,9 +35,9 @@ pub use self::ord::SqlOrd;
///
/// [bool]: https://doc.rust-lang.org/nightly/std/primitive.bool.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "16", array_oid = "1000")]
#[sqlite_type = "Integer"]
#[mysql_type = "Tiny"]
#[cfg_attr(feature = "postgres", postgres(oid = "16", array_oid = "1000"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Integer")]
#[cfg_attr(feature = "mysql", mysql_type = "Tiny")]
pub struct Bool;

/// The tiny integer SQL type.
Expand All @@ -56,7 +56,7 @@ pub struct Bool;
///
/// [i8]: https://doc.rust-lang.org/nightly/std/primitive.i8.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[mysql_type = "Tiny"]
#[cfg_attr(feature = "mysql", mysql_type = "Tiny")]
pub struct TinyInt;
#[doc(hidden)]
pub type Tinyint = TinyInt;
Expand All @@ -73,9 +73,9 @@ pub type Tinyint = TinyInt;
///
/// [i16]: https://doc.rust-lang.org/nightly/std/primitive.i16.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "21", array_oid = "1005")]
#[sqlite_type = "SmallInt"]
#[mysql_type = "Short"]
#[cfg_attr(feature = "postgres", postgres(oid = "21", array_oid = "1005"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "SmallInt")]
#[cfg_attr(feature = "mysql", mysql_type = "Short")]
pub struct SmallInt;
#[doc(hidden)]
pub type Int2 = SmallInt;
Expand All @@ -94,9 +94,9 @@ pub type Smallint = SmallInt;
///
/// [i32]: https://doc.rust-lang.org/nightly/std/primitive.i32.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "23", array_oid = "1007")]
#[sqlite_type = "Integer"]
#[mysql_type = "Long"]
#[cfg_attr(feature = "postgres", postgres(oid = "23", array_oid = "1007"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Integer")]
#[cfg_attr(feature = "mysql", mysql_type = "Long")]
pub struct Integer;
#[doc(hidden)]
pub type Int4 = Integer;
Expand All @@ -113,9 +113,9 @@ pub type Int4 = Integer;
///
/// [i64]: https://doc.rust-lang.org/nightly/std/primitive.i64.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "20", array_oid = "1016")]
#[sqlite_type = "Long"]
#[mysql_type = "LongLong"]
#[cfg_attr(feature = "postgres", postgres(oid = "20", array_oid = "1016"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Long")]
#[cfg_attr(feature = "mysql", mysql_type = "LongLong")]
pub struct BigInt;
#[doc(hidden)]
pub type Int8 = BigInt;
Expand All @@ -134,9 +134,9 @@ pub type Bigint = BigInt;
///
/// [f32]: https://doc.rust-lang.org/nightly/std/primitive.f32.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "700", array_oid = "1021")]
#[sqlite_type = "Float"]
#[mysql_type = "Float"]
#[cfg_attr(feature = "postgres", postgres(oid = "700", array_oid = "1021"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Float")]
#[cfg_attr(feature = "mysql", mysql_type = "Float")]
pub struct Float;
#[doc(hidden)]
pub type Float4 = Float;
Expand All @@ -153,9 +153,9 @@ pub type Float4 = Float;
///
/// [f64]: https://doc.rust-lang.org/nightly/std/primitive.f64.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "701", array_oid = "1022")]
#[sqlite_type = "Double"]
#[mysql_type = "Double"]
#[cfg_attr(feature = "postgres", postgres(oid = "701", array_oid = "1022"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Double")]
#[cfg_attr(feature = "mysql", mysql_type = "Double")]
pub struct Double;
#[doc(hidden)]
pub type Float8 = Double;
Expand All @@ -175,9 +175,9 @@ pub type Float8 = Double;
///
/// [`bigdecimal::BigDecimal`]: /bigdecimal/struct.BigDecimal.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "1700", array_oid = "1231")]
#[mysql_type = "String"]
#[sqlite_type = "Double"]
#[cfg_attr(feature = "postgres", postgres(oid = "1700", array_oid = "1231"))]
#[cfg_attr(feature = "mysql", mysql_type = "String")]
#[cfg_attr(feature = "sqlite", sqlite_type = "Double")]
pub struct Numeric;

/// Alias for `Numeric`
Expand All @@ -203,9 +203,9 @@ pub type Decimal = Numeric;
/// [String]: https://doc.rust-lang.org/nightly/std/string/struct.String.html
/// [str]: https://doc.rust-lang.org/nightly/std/primitive.str.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "25", array_oid = "1009")]
#[sqlite_type = "Text"]
#[mysql_type = "String"]
#[cfg_attr(feature = "postgres", postgres(oid = "25", array_oid = "1009"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Text")]
#[cfg_attr(feature = "mysql", mysql_type = "String")]
pub struct Text;

/// The SQL `VARCHAR` type
Expand Down Expand Up @@ -246,9 +246,9 @@ pub type Longtext = Text;
/// [Vec]: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html
/// [slice]: https://doc.rust-lang.org/nightly/std/primitive.slice.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "17", array_oid = "1001")]
#[sqlite_type = "Binary"]
#[mysql_type = "Blob"]
#[cfg_attr(feature = "postgres", postgres(oid = "17", array_oid = "1001"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Binary")]
#[cfg_attr(feature = "mysql", mysql_type = "Blob")]
pub struct Binary;

#[doc(hidden)]
Expand Down Expand Up @@ -276,9 +276,9 @@ pub type Bit = Binary;
///
/// [NaiveDate]: /chrono/naive/date/struct.NaiveDate.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "1082", array_oid = "1182")]
#[sqlite_type = "Text"]
#[mysql_type = "Date"]
#[cfg_attr(feature = "postgres", postgres(oid = "1082", array_oid = "1182"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Text")]
#[cfg_attr(feature = "mysql", mysql_type = "Date")]
pub struct Date;

/// The interval SQL type.
Expand All @@ -296,7 +296,7 @@ pub struct Date;
/// [`PgInterval`]: ../pg/data_types/struct.PgInterval.html
/// [`IntervalDsl`]: ../pg/expression/extensions/trait.IntervalDsl.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "1186", array_oid = "1187")]
#[cfg_attr(feature = "postgres", postgres(oid = "1186", array_oid = "1187"))]
pub struct Interval;

/// The time SQL type.
Expand All @@ -311,9 +311,9 @@ pub struct Interval;
///
/// [NaiveTime]: /chrono/naive/time/struct.NaiveTime.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "1083", array_oid = "1183")]
#[sqlite_type = "Text"]
#[mysql_type = "Time"]
#[cfg_attr(feature = "postgres", postgres(oid = "1083", array_oid = "1183"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Text")]
#[cfg_attr(feature = "mysql", mysql_type = "Time")]
pub struct Time;

/// The timestamp SQL type.
Expand All @@ -334,9 +334,9 @@ pub struct Time;
/// [NaiveDateTime]: /chrono/naive/datetime/struct.NaiveDateTime.html
/// [Timespec]: /time/struct.Timespec.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[postgres(oid = "1114", array_oid = "1115")]
#[sqlite_type = "Text"]
#[mysql_type = "Timestamp"]
#[cfg_attr(feature = "postgres", postgres(oid = "1114", array_oid = "1115"))]
#[cfg_attr(feature = "sqlite", sqlite_type = "Text")]
#[cfg_attr(feature = "mysql", mysql_type = "Timestamp")]
pub struct Timestamp;

/// The nullable SQL type.
Expand Down
4 changes: 2 additions & 2 deletions examples/postgres/advanced-blog-cli/Cargo.toml
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Sean Griffin <sean@seantheprogrammer.com>"]

[dependencies]
bcrypt = "0.2.0"
bcrypt = "0.8.1"
chrono = "0.4.0"
diesel = { version = "1.4.0", features = ["postgres", "chrono"] }
dotenv = "0.10.0"
Expand All @@ -20,4 +20,4 @@ lazy_static = "1.0"
[[bin]]
name = "advanced-blog-cli"
path = "src/main.rs"
doc = false
doc = false