add migrate file for delete html from answer content (copy from core branch - cleaningContent)
This commit is contained in:
parent
01abb94a5e
commit
2fd9569574
0
dal/schema/000015_init.down.sql
Normal file
0
dal/schema/000015_init.down.sql
Normal file
19
dal/schema/000015_init.up.sql
Normal file
19
dal/schema/000015_init.up.sql
Normal file
@ -0,0 +1,19 @@
|
||||
UPDATE answer
|
||||
SET content =
|
||||
CASE
|
||||
WHEN content ~ '<tr>|<td>' THEN
|
||||
regexp_replace(content, '<\/?tr[^>]*>|<\/?td[^>]*>', '', 'g')
|
||||
WHEN content ~ '<a download>[^<]+</a>' THEN
|
||||
regexp_replace(content, '<a download>([^<]+)</a>', '\1', 'g')
|
||||
WHEN content ~ '<img[^>]*src="([^"]*)"[^>]*' THEN
|
||||
regexp_replace(content, '<img[^>]*src="\s*"[^>]*', '', 'g')
|
||||
ELSE content
|
||||
END;
|
||||
|
||||
UPDATE answer
|
||||
SET content =
|
||||
CASE
|
||||
WHEN content ~ '<img' THEN
|
||||
regexp_replace(content, '(.*?)(<img[^>]*src=["'']?([^"''>]+)["'']?[^>]*>)', '\1\3', 'g')
|
||||
ELSE content
|
||||
END;
|
Loading…
Reference in New Issue
Block a user