derpibooru / philomena

Next-generation imageboard
https://derpibooru.org/
GNU Affero General Public License v3.0
219 stars 57 forks source link

Database cleanups #28

Open liamwhite opened 4 years ago

liamwhite commented 4 years ago

It's at this point much better than it originally was, but still need in of many small cleanups to begin approaching any normal form.

dead columns:
  channels:
    - description
    - channel_image
    - tags
    - viewers
    - watcher_ids
    - watcher_count
    - viewer_minutes_today
    - viewer_minutes_thisweek
    - viewer_minutes_thismonth
    - total_viewer_minutes
    - banner_image
    - remote_stream_id
    - thumbnail_url

  comments:
    - referrer
    - user_agent

  forums:
    - watcher_ids
    - watcher_count

  galleries:
    - watcher_ids
    - watcher_count

  images:
    - watcher_ids
    - watcher_count
    - tag_ids
    - se_intensity
    - sw_intensity
    - ne_intensity
    - nw_intensity
    - average_intensity
    - votes_count

  notifications:
    - watcher_ids

  polls:
    - hidden_from_users
    - deleted_by_id
    - deletion_reason

  posts:
    - referrer
    - user_agent

  roles:
    - resource_id
    - created_at
    - updated_at

  reports:
    - referrer
    - user_agent

  source_changes:
    - referrer
    - user_agent

  tag_changes:
    - referrer
    - user_agent

  topics:
    - watcher_ids
    - watcher_count

  user_links:
    - hostname
    - path

  users:
    - sign_in_count
    - current_sign_in_at
    - current_sign_in_ip
    - last_sign_in_ip
    - last_renamed_at
    - last_donation_at
    - unread_notification_ids
    - scratchpad

  versions:
    - event

  vpns:
    - ip

arrays:
  commissions:
    - categories

  filters:
    - hidden_tag_ids
    - spoilered_tag_ids

  users:
    - recent_filter_ids
    - watched_tag_ids
    - otp_backup_codes

missing NOT NULL:
  adverts:
    - image
    - link
    - title
    - start_date
    - finish_date
    - restrictions

  badges:
    - image

  comments:
    - ip
    - fingerprint
    - user_agent
    - referrer

  commission_items:
    - commission_id
    - item_type
    - description
    - base_price
    - add_ons
    - example_image_id

  commissions:
    - information
    - contact

  fingerprint_bans:
    - fingerprint

  posts:
    - ip
    - fingerprint
    - user_agent
    - referrer

  source_changes:
    - ip
    - fingerprint
    - user_agent
    - referrer

  tag_changes:
    - ip
    - fingerprint
    - user_agent
    - referrer

  versions:
    - created_at

missing keys:
  gallery_interactions:
    - [image_id, gallery_id]

ActiveRecord workarounds:
  forums:
    - last_post_id
    - last_topic_id

  images:
    - tag_list_cache
    - tag_list_plus_alias_cache
    - file_name_cache

precision 6:
  image_features:
    - created_at
    - updated_at

  static_page_versions:
    - created_at
    - updated_at

  static_pages:
    - created_at
    - updated_at

other:
  - convert referencing columns to bigint
  - convert varchar to text
  - stop storing otp secrets in encrypted form
Meow commented 4 years ago

That is a lot of obvious changes once you think about it. Gonna be one hell of a task though.