Rewrote the comments system. ()

old one basically bitrotted to death, may it rinse in prosciutto

Reviewed-on: 
Co-authored-by: flashwave <me@flash.moe>
Co-committed-by: flashwave <me@flash.moe>
This commit is contained in:
flash 2025-02-20 02:19:32 +00:00 committed by flash
parent 6b2bfb726f
commit 7353553de7
66 changed files with 3320 additions and 2088 deletions

View file

@ -0,0 +1,39 @@
<?php
use Index\Db\DbConnection;
use Index\Db\Migration\DbMigration;
final class DontAutoupdateCommentPostEditedField_20250210_230238 implements DbMigration {
public function migrate(DbConnection $conn): void {
$conn->execute(<<<SQL
ALTER TABLE msz_comments_posts
CHANGE COLUMN comment_edited comment_edited TIMESTAMP NULL DEFAULT NULL AFTER comment_pinned;
SQL);
$conn->execute(<<<SQL
ALTER TABLE msz_news_posts
DROP FOREIGN KEY news_posts_category_id_foreign,
DROP FOREIGN KEY news_posts_user_id_foreign;
SQL);
$conn->execute(<<<SQL
ALTER TABLE msz_news_posts
DROP COLUMN comment_section_id,
DROP INDEX news_posts_comment_section,
DROP INDEX news_posts_category_id_foreign,
ADD INDEX news_posts_categories_foreign (category_id),
DROP INDEX news_posts_user_id_foreign,
ADD INDEX news_posts_users_foreign (user_id),
DROP FOREIGN KEY news_posts_comment_section,
ADD CONSTRAINT news_posts_categories_foreign
FOREIGN KEY (category_id)
REFERENCES msz_news_categories (category_id)
ON UPDATE CASCADE
ON DELETE CASCADE,
ADD CONSTRAINT news_posts_users_foreign
FOREIGN KEY (user_id)
REFERENCES msz_users (user_id)
ON UPDATE CASCADE
ON DELETE SET NULL;
SQL);
}
}