X-Git-Url: http://these/git/?a=blobdiff_plain;f=migrations%2F2023-06-06-104440_index_post_url%2Fup.sql;h=ce3532887214ca2ff17deb7a938891399026a144;hb=8cb5939f5048c3eab293884923d4c3d5fcc08e2f;hp=4f8ea66ff79ca3efc8dbbda637dffcfad7386bf8;hpb=4e5798852f583a68d123a9c49ae0ef59ec9ffc76;p=lemmy.git diff --git a/migrations/2023-06-06-104440_index_post_url/up.sql b/migrations/2023-06-06-104440_index_post_url/up.sql index 4f8ea66f..ce353288 100644 --- a/migrations/2023-06-06-104440_index_post_url/up.sql +++ b/migrations/2023-06-06-104440_index_post_url/up.sql @@ -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);