mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-09-19 20:30:16 +00:00
Fixing post.url migration.
This commit is contained in:
parent
1d338d56f1
commit
f203abd4e1
|
@ -636,7 +636,8 @@ diesel::table! {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
#[max_length = 200]
|
#[max_length = 200]
|
||||||
name -> Varchar,
|
name -> Varchar,
|
||||||
url -> Nullable<Text>,
|
#[max_length = 512]
|
||||||
|
url -> Nullable<Varchar>,
|
||||||
body -> Nullable<Text>,
|
body -> Nullable<Text>,
|
||||||
creator_id -> Int4,
|
creator_id -> Int4,
|
||||||
community_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;
|
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);
|
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
|
/// Update the hot_rank columns for the aggregates tables
|
||||||
fn update_hot_ranks(conn: &mut PgConnection, last_week_only: bool) {
|
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 post_update = diesel::update(post_aggregates::table).into_boxed();
|
||||||
let mut comment_update = diesel::update(comment_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();
|
let mut community_update = diesel::update(community_aggregates::table).into_boxed();
|
||||||
|
|
Loading…
Reference in a new issue