Files
danbooru/db/views/ip_addresses_v01.sql
evazion bf6bb94702 Add new IP address search page.
Add a new IP address search page at /ip_addresses. Replaces the old
search page at /moderator/ip_addrs.

On user profile pages, show the user's last known IP to mods. Also add
search links for finding other IPs or accounts associated with the user.

IP address search uses a big UNION ALL statement to merge IP addresses
across various tables into a single view. This makes searching easier,
but is known to timeout in certain cases.

Fixes #4207 (the new IP search page supports searching by subnet).
2019-11-11 21:03:07 -06:00

25 lines
837 B
SQL

SELECT 'ArtistVersion' AS model_type, id AS model_id, updater_id AS user_id, updater_ip_addr AS ip_addr, created_at
FROM artist_versions
UNION ALL
SELECT 'ArtistCommentaryVersion', id, updater_id, updater_ip_addr, created_at
FROM artist_commentary_versions
UNION ALL
SELECT 'Comment', id, creator_id, creator_ip_addr, created_at
FROM comments
UNION ALL
SELECT 'Dmail', id, from_id, creator_ip_addr, created_at
FROM dmails
UNION ALL
SELECT 'NoteVersion', id, updater_id, updater_ip_addr, created_at
FROM note_versions
UNION ALL
SELECT 'Post', id, uploader_id, uploader_ip_addr, created_at
FROM posts
UNION ALL
SELECT 'User', id, id, last_ip_addr, created_at
FROM users
WHERE last_ip_addr IS NOT NULL
UNION ALL
SELECT 'WikiPageVersion', id, updater_id, updater_ip_addr, created_at
FROM wiki_page_versions