mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 03:24:00 +00:00
Fixing post.url migration.
This commit is contained in:
parent
1d338d56f1
commit
f203abd4e1
|
@ -636,7 +636,8 @@ diesel::table! {
|
|||
id -> Int4,
|
||||
#[max_length = 200]
|
||||
name -> Varchar,
|
||||
url -> Nullable<Text>,
|
||||
#[max_length = 512]
|
||||
url -> Nullable<Varchar>,
|
||||
body -> Nullable<Text>,
|
||||
creator_id -> Int4,
|
||||
community_id -> Int4,
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
-- Change back the column type
|
||||
alter table post alter column url type text;
|
||||
|
||||
-- Drop the index
|
||||
drop index idx_post_url;
|
||||
|
|
|
@ -1 +1,9 @@
|
|||
-- Make a hard limit of 512 for the post.url column
|
||||
-- Truncate existing long rows.
|
||||
update post set url = left(url, 512) where length(url) > 512;
|
||||
|
||||
-- Enforce the limit
|
||||
alter table post alter column url type varchar (512);
|
||||
|
||||
-- Add the index
|
||||
create index idx_post_url on post(url);
|
||||
|
|
|
@ -72,8 +72,6 @@ pub fn setup(db_url: String, user_agent: String) -> Result<(), LemmyError> {
|
|||
|
||||
/// Update the hot_rank columns for the aggregates tables
|
||||
fn update_hot_ranks(conn: &mut PgConnection, last_week_only: bool) {
|
||||
info!("Updating hot ranks...");
|
||||
|
||||
let mut post_update = diesel::update(post_aggregates::table).into_boxed();
|
||||
let mut comment_update = diesel::update(comment_aggregates::table).into_boxed();
|
||||
let mut community_update = diesel::update(community_aggregates::table).into_boxed();
|
||||
|
|
Loading…
Reference in a new issue