mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 11:21:02 +00:00
* update diesel to 2.1.0 and diesel-async to 0.3.0 (issue #2882) * get rid of deprecated RawValue type alias usage, explicitly import diesel types instead of using wildcard import * Update diesel-derive-enum and diesel-derive-newtype libraries * Revert manual changes to schema.rs * Update to newer diesel-cli image in CI, run fix-clippy before schema comparison, update schema to one generated with diesel-cli 2.1.0 and clippyfixed * Remove wildcard import lint, fix diesel schema pipeline --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
af03dcfeac
commit
24323e17b2
5 changed files with 340 additions and 231 deletions
|
@ -79,8 +79,8 @@ pipeline:
|
||||||
-D clippy::style -D clippy::correctness -D clippy::suspicious
|
-D clippy::style -D clippy::correctness -D clippy::suspicious
|
||||||
-D clippy::dbg_macro -D clippy::inefficient_to_string
|
-D clippy::dbg_macro -D clippy::inefficient_to_string
|
||||||
-D clippy::items-after-statements -D clippy::implicit_clone
|
-D clippy::items-after-statements -D clippy::implicit_clone
|
||||||
-D clippy::wildcard_imports -D clippy::cast_lossless
|
-D clippy::cast_lossless -D clippy::manual_string_new
|
||||||
-D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
|
-D clippy::redundant_closure_for_method_calls
|
||||||
-D clippy::unused_self
|
-D clippy::unused_self
|
||||||
-A clippy::uninlined_format_args
|
-A clippy::uninlined_format_args
|
||||||
-D clippy::get_first
|
-D clippy::get_first
|
||||||
|
@ -111,7 +111,7 @@ pipeline:
|
||||||
# platform: linux/amd64
|
# platform: linux/amd64
|
||||||
|
|
||||||
check_diesel_schema:
|
check_diesel_schema:
|
||||||
image: jameshiew/diesel-cli
|
image: willsquire/diesel-cli
|
||||||
environment:
|
environment:
|
||||||
CARGO_HOME: .cargo
|
CARGO_HOME: .cargo
|
||||||
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
||||||
|
|
516
Cargo.lock
generated
516
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
10
Cargo.toml
10
Cargo.toml
|
@ -60,9 +60,9 @@ lemmy_db_views = { version = "=0.17.1", path = "./crates/db_views" }
|
||||||
lemmy_db_views_actor = { version = "=0.17.1", path = "./crates/db_views_actor" }
|
lemmy_db_views_actor = { version = "=0.17.1", path = "./crates/db_views_actor" }
|
||||||
lemmy_db_views_moderator = { version = "=0.17.1", path = "./crates/db_views_moderator" }
|
lemmy_db_views_moderator = { version = "=0.17.1", path = "./crates/db_views_moderator" }
|
||||||
activitypub_federation = { version = "0.4.0", default-features = false, features = ["actix-web"] }
|
activitypub_federation = { version = "0.4.0", default-features = false, features = ["actix-web"] }
|
||||||
diesel = "2.0.2"
|
diesel = "2.1.0"
|
||||||
diesel_migrations = "2.0.0"
|
diesel_migrations = "2.1.0"
|
||||||
diesel-async = "0.1.1"
|
diesel-async = "0.3.0"
|
||||||
serde = { version = "1.0.147", features = ["derive"] }
|
serde = { version = "1.0.147", features = ["derive"] }
|
||||||
serde_with = "1.14.0"
|
serde_with = "1.14.0"
|
||||||
actix-web = { version = "4.2.1", default-features = false, features = ["macros", "rustls"] }
|
actix-web = { version = "4.2.1", default-features = false, features = ["macros", "rustls"] }
|
||||||
|
@ -93,8 +93,8 @@ tokio = "1.21.2"
|
||||||
sha2 = "0.10.6"
|
sha2 = "0.10.6"
|
||||||
regex = "1.6.0"
|
regex = "1.6.0"
|
||||||
once_cell = "1.15.0"
|
once_cell = "1.15.0"
|
||||||
diesel-derive-newtype = "2.0.0-rc.0"
|
diesel-derive-newtype = "2.0.0"
|
||||||
diesel-derive-enum = {version = "2.0.1", features = ["postgres"] }
|
diesel-derive-enum = {version = "2.1.0", features = ["postgres"] }
|
||||||
strum = "0.24.1"
|
strum = "0.24.1"
|
||||||
strum_macros = "0.24.3"
|
strum_macros = "0.24.3"
|
||||||
itertools = "0.10.5"
|
itertools = "0.10.5"
|
||||||
|
|
|
@ -65,7 +65,7 @@ diesel::table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
use diesel::sql_types::*;
|
use diesel::sql_types::{Bool, Int4, Nullable, Text, Timestamp, Varchar};
|
||||||
use diesel_ltree::sql_types::Ltree;
|
use diesel_ltree::sql_types::Ltree;
|
||||||
|
|
||||||
comment (id) {
|
comment (id) {
|
||||||
|
@ -77,6 +77,7 @@ diesel::table! {
|
||||||
published -> Timestamp,
|
published -> Timestamp,
|
||||||
updated -> Nullable<Timestamp>,
|
updated -> Nullable<Timestamp>,
|
||||||
deleted -> Bool,
|
deleted -> Bool,
|
||||||
|
#[max_length = 255]
|
||||||
ap_id -> Varchar,
|
ap_id -> Varchar,
|
||||||
local -> Bool,
|
local -> Bool,
|
||||||
path -> Ltree,
|
path -> Ltree,
|
||||||
|
@ -144,7 +145,9 @@ diesel::table! {
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
community (id) {
|
community (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
|
#[max_length = 255]
|
||||||
name -> Varchar,
|
name -> Varchar,
|
||||||
|
#[max_length = 255]
|
||||||
title -> Varchar,
|
title -> Varchar,
|
||||||
description -> Nullable<Text>,
|
description -> Nullable<Text>,
|
||||||
removed -> Bool,
|
removed -> Bool,
|
||||||
|
@ -152,6 +155,7 @@ diesel::table! {
|
||||||
updated -> Nullable<Timestamp>,
|
updated -> Nullable<Timestamp>,
|
||||||
deleted -> Bool,
|
deleted -> Bool,
|
||||||
nsfw -> Bool,
|
nsfw -> Bool,
|
||||||
|
#[max_length = 255]
|
||||||
actor_id -> Varchar,
|
actor_id -> Varchar,
|
||||||
local -> Bool,
|
local -> Bool,
|
||||||
private_key -> Nullable<Text>,
|
private_key -> Nullable<Text>,
|
||||||
|
@ -159,13 +163,18 @@ diesel::table! {
|
||||||
last_refreshed_at -> Timestamp,
|
last_refreshed_at -> Timestamp,
|
||||||
icon -> Nullable<Text>,
|
icon -> Nullable<Text>,
|
||||||
banner -> Nullable<Text>,
|
banner -> Nullable<Text>,
|
||||||
|
#[max_length = 255]
|
||||||
followers_url -> Varchar,
|
followers_url -> Varchar,
|
||||||
|
#[max_length = 255]
|
||||||
inbox_url -> Varchar,
|
inbox_url -> Varchar,
|
||||||
|
#[max_length = 255]
|
||||||
shared_inbox_url -> Nullable<Varchar>,
|
shared_inbox_url -> Nullable<Varchar>,
|
||||||
hidden -> Bool,
|
hidden -> Bool,
|
||||||
posting_restricted_to_mods -> Bool,
|
posting_restricted_to_mods -> Bool,
|
||||||
instance_id -> Int4,
|
instance_id -> Int4,
|
||||||
|
#[max_length = 255]
|
||||||
moderators_url -> Nullable<Varchar>,
|
moderators_url -> Nullable<Varchar>,
|
||||||
|
#[max_length = 255]
|
||||||
featured_url -> Nullable<Varchar>,
|
featured_url -> Nullable<Varchar>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,6 +244,7 @@ diesel::table! {
|
||||||
custom_emoji (id) {
|
custom_emoji (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
local_site_id -> Int4,
|
local_site_id -> Int4,
|
||||||
|
#[max_length = 128]
|
||||||
shortcode -> Varchar,
|
shortcode -> Varchar,
|
||||||
image_url -> Text,
|
image_url -> Text,
|
||||||
alt_text -> Text,
|
alt_text -> Text,
|
||||||
|
@ -248,6 +258,7 @@ diesel::table! {
|
||||||
custom_emoji_keyword (id) {
|
custom_emoji_keyword (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
custom_emoji_id -> Int4,
|
custom_emoji_id -> Int4,
|
||||||
|
#[max_length = 128]
|
||||||
keyword -> Varchar,
|
keyword -> Varchar,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,10 +294,13 @@ diesel::table! {
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
instance (id) {
|
instance (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
|
#[max_length = 255]
|
||||||
domain -> Varchar,
|
domain -> Varchar,
|
||||||
published -> Timestamp,
|
published -> Timestamp,
|
||||||
updated -> Nullable<Timestamp>,
|
updated -> Nullable<Timestamp>,
|
||||||
|
#[max_length = 255]
|
||||||
software -> Nullable<Varchar>,
|
software -> Nullable<Varchar>,
|
||||||
|
#[max_length = 255]
|
||||||
version -> Nullable<Varchar>,
|
version -> Nullable<Varchar>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,13 +308,14 @@ diesel::table! {
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
language (id) {
|
language (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
|
#[max_length = 3]
|
||||||
code -> Varchar,
|
code -> Varchar,
|
||||||
name -> Text,
|
name -> Text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
use diesel::sql_types::*;
|
use diesel::sql_types::{Bool, Int4, Nullable, Text, Timestamp, Varchar};
|
||||||
use super::sql_types::ListingTypeEnum;
|
use super::sql_types::ListingTypeEnum;
|
||||||
use super::sql_types::RegistrationModeEnum;
|
use super::sql_types::RegistrationModeEnum;
|
||||||
|
|
||||||
|
@ -325,6 +340,7 @@ diesel::table! {
|
||||||
federation_debug -> Bool,
|
federation_debug -> Bool,
|
||||||
federation_worker_count -> Int4,
|
federation_worker_count -> Int4,
|
||||||
captcha_enabled -> Bool,
|
captcha_enabled -> Bool,
|
||||||
|
#[max_length = 255]
|
||||||
captcha_difficulty -> Varchar,
|
captcha_difficulty -> Varchar,
|
||||||
published -> Timestamp,
|
published -> Timestamp,
|
||||||
updated -> Nullable<Timestamp>,
|
updated -> Nullable<Timestamp>,
|
||||||
|
@ -355,7 +371,7 @@ diesel::table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
use diesel::sql_types::*;
|
use diesel::sql_types::{Bool, Int4, Nullable, Text, Timestamp, Varchar};
|
||||||
use super::sql_types::SortTypeEnum;
|
use super::sql_types::SortTypeEnum;
|
||||||
use super::sql_types::ListingTypeEnum;
|
use super::sql_types::ListingTypeEnum;
|
||||||
|
|
||||||
|
@ -365,9 +381,11 @@ diesel::table! {
|
||||||
password_encrypted -> Text,
|
password_encrypted -> Text,
|
||||||
email -> Nullable<Text>,
|
email -> Nullable<Text>,
|
||||||
show_nsfw -> Bool,
|
show_nsfw -> Bool,
|
||||||
|
#[max_length = 20]
|
||||||
theme -> Varchar,
|
theme -> Varchar,
|
||||||
default_sort_type -> SortTypeEnum,
|
default_sort_type -> SortTypeEnum,
|
||||||
default_listing_type -> ListingTypeEnum,
|
default_listing_type -> ListingTypeEnum,
|
||||||
|
#[max_length = 20]
|
||||||
interface_language -> Varchar,
|
interface_language -> Varchar,
|
||||||
show_avatars -> Bool,
|
show_avatars -> Bool,
|
||||||
send_notifications_to_email -> Bool,
|
send_notifications_to_email -> Bool,
|
||||||
|
@ -525,12 +543,15 @@ diesel::table! {
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
person (id) {
|
person (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
|
#[max_length = 255]
|
||||||
name -> Varchar,
|
name -> Varchar,
|
||||||
|
#[max_length = 255]
|
||||||
display_name -> Nullable<Varchar>,
|
display_name -> Nullable<Varchar>,
|
||||||
avatar -> Nullable<Text>,
|
avatar -> Nullable<Text>,
|
||||||
banned -> Bool,
|
banned -> Bool,
|
||||||
published -> Timestamp,
|
published -> Timestamp,
|
||||||
updated -> Nullable<Timestamp>,
|
updated -> Nullable<Timestamp>,
|
||||||
|
#[max_length = 255]
|
||||||
actor_id -> Varchar,
|
actor_id -> Varchar,
|
||||||
bio -> Nullable<Text>,
|
bio -> Nullable<Text>,
|
||||||
local -> Bool,
|
local -> Bool,
|
||||||
|
@ -539,7 +560,9 @@ diesel::table! {
|
||||||
last_refreshed_at -> Timestamp,
|
last_refreshed_at -> Timestamp,
|
||||||
banner -> Nullable<Text>,
|
banner -> Nullable<Text>,
|
||||||
deleted -> Bool,
|
deleted -> Bool,
|
||||||
|
#[max_length = 255]
|
||||||
inbox_url -> Varchar,
|
inbox_url -> Varchar,
|
||||||
|
#[max_length = 255]
|
||||||
shared_inbox_url -> Nullable<Varchar>,
|
shared_inbox_url -> Nullable<Varchar>,
|
||||||
matrix_user_id -> Nullable<Text>,
|
matrix_user_id -> Nullable<Text>,
|
||||||
admin -> Bool,
|
admin -> Bool,
|
||||||
|
@ -610,6 +633,7 @@ diesel::table! {
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
post (id) {
|
post (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
|
#[max_length = 200]
|
||||||
name -> Varchar,
|
name -> Varchar,
|
||||||
url -> Nullable<Text>,
|
url -> Nullable<Text>,
|
||||||
body -> Nullable<Text>,
|
body -> Nullable<Text>,
|
||||||
|
@ -624,6 +648,7 @@ diesel::table! {
|
||||||
embed_title -> Nullable<Text>,
|
embed_title -> Nullable<Text>,
|
||||||
embed_description -> Nullable<Text>,
|
embed_description -> Nullable<Text>,
|
||||||
thumbnail_url -> Nullable<Text>,
|
thumbnail_url -> Nullable<Text>,
|
||||||
|
#[max_length = 255]
|
||||||
ap_id -> Varchar,
|
ap_id -> Varchar,
|
||||||
local -> Bool,
|
local -> Bool,
|
||||||
embed_video_url -> Nullable<Text>,
|
embed_video_url -> Nullable<Text>,
|
||||||
|
@ -673,6 +698,7 @@ diesel::table! {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
creator_id -> Int4,
|
creator_id -> Int4,
|
||||||
post_id -> Int4,
|
post_id -> Int4,
|
||||||
|
#[max_length = 200]
|
||||||
original_post_name -> Varchar,
|
original_post_name -> Varchar,
|
||||||
original_post_url -> Nullable<Text>,
|
original_post_url -> Nullable<Text>,
|
||||||
original_post_body -> Nullable<Text>,
|
original_post_body -> Nullable<Text>,
|
||||||
|
@ -703,6 +729,7 @@ diesel::table! {
|
||||||
read -> Bool,
|
read -> Bool,
|
||||||
published -> Timestamp,
|
published -> Timestamp,
|
||||||
updated -> Nullable<Timestamp>,
|
updated -> Nullable<Timestamp>,
|
||||||
|
#[max_length = 255]
|
||||||
ap_id -> Varchar,
|
ap_id -> Varchar,
|
||||||
local -> Bool,
|
local -> Bool,
|
||||||
}
|
}
|
||||||
|
@ -743,15 +770,19 @@ diesel::table! {
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
site (id) {
|
site (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
|
#[max_length = 20]
|
||||||
name -> Varchar,
|
name -> Varchar,
|
||||||
sidebar -> Nullable<Text>,
|
sidebar -> Nullable<Text>,
|
||||||
published -> Timestamp,
|
published -> Timestamp,
|
||||||
updated -> Nullable<Timestamp>,
|
updated -> Nullable<Timestamp>,
|
||||||
icon -> Nullable<Text>,
|
icon -> Nullable<Text>,
|
||||||
banner -> Nullable<Text>,
|
banner -> Nullable<Text>,
|
||||||
|
#[max_length = 150]
|
||||||
description -> Nullable<Varchar>,
|
description -> Nullable<Varchar>,
|
||||||
|
#[max_length = 255]
|
||||||
actor_id -> Varchar,
|
actor_id -> Varchar,
|
||||||
last_refreshed_at -> Timestamp,
|
last_refreshed_at -> Timestamp,
|
||||||
|
#[max_length = 255]
|
||||||
inbox_url -> Varchar,
|
inbox_url -> Varchar,
|
||||||
private_key -> Nullable<Text>,
|
private_key -> Nullable<Text>,
|
||||||
public_key -> Text,
|
public_key -> Text,
|
||||||
|
|
|
@ -229,7 +229,7 @@ impl<DB: Backend> FromSql<Text, DB> for DbUrl
|
||||||
where
|
where
|
||||||
String: FromSql<Text, DB>,
|
String: FromSql<Text, DB>,
|
||||||
{
|
{
|
||||||
fn from_sql(value: diesel::backend::RawValue<'_, DB>) -> diesel::deserialize::Result<Self> {
|
fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> {
|
||||||
let str = String::from_sql(value)?;
|
let str = String::from_sql(value)?;
|
||||||
Ok(DbUrl(Box::new(Url::parse(&str)?)))
|
Ok(DbUrl(Box::new(Url::parse(&str)?)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue