]> Untitled Git - lemmy.git/blob - migrations/2023-06-06-104440_index_post_url/up.sql
Speedup CI (#3852)
[lemmy.git] / migrations / 2023-06-06-104440_index_post_url / up.sql
1 -- Make a hard limit of 512 for the post.url column
2 -- Truncate existing long rows.
3 UPDATE
4     post
5 SET
6     url =
7     LEFT (url,
8         512)
9 WHERE
10     length(url) > 512;
11
12 -- Enforce the limit
13 ALTER TABLE post
14     ALTER COLUMN url TYPE varchar(512);
15
16 -- Add the index
17 CREATE INDEX idx_post_url ON post (url);
18