Changed internal parser selection value from integers to a string enum.
This commit is contained in:
parent
4d53565139
commit
d9f35594e7
32 changed files with 301 additions and 213 deletions
54
database/2025_02_08_153444_new_parsing_method_storage.php
Normal file
54
database/2025_02_08_153444_new_parsing_method_storage.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
use Index\Db\DbConnection;
|
||||
use Index\Db\Migration\DbMigration;
|
||||
|
||||
final class NewParsingMethodStorage_20250208_153444 implements DbMigration {
|
||||
public function migrate(DbConnection $conn): void {
|
||||
// msz_forum_posts
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_forum_posts
|
||||
ADD COLUMN post_text_format ENUM('','bb','md') NOT NULL DEFAULT '' AFTER post_text,
|
||||
ADD INDEX posts_text_format_index (post_text_format);
|
||||
SQL);
|
||||
$conn->execute(<<<SQL
|
||||
UPDATE msz_forum_posts
|
||||
SET post_text_format = IF(post_parse = 2, 'md', IF(post_parse = 1, 'bb', ''));
|
||||
SQL);
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_forum_posts
|
||||
DROP COLUMN post_parse,
|
||||
DROP INDEX posts_parse_index;
|
||||
SQL);
|
||||
|
||||
// msz_messages
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_messages
|
||||
ADD COLUMN msg_body_format ENUM('','bb','md') NOT NULL DEFAULT '' AFTER msg_body;
|
||||
SQL);
|
||||
$conn->execute(<<<SQL
|
||||
UPDATE msz_messages
|
||||
SET msg_body_format = IF(msg_parser = 2, 'md', IF(msg_parser = 1, 'bb', ''));
|
||||
SQL);
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_messages
|
||||
DROP COLUMN msg_parser;
|
||||
SQL);
|
||||
|
||||
// msz_users
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_users
|
||||
ADD COLUMN user_about_content_format ENUM('','bb','md') NOT NULL DEFAULT '' AFTER user_about_content,
|
||||
ADD COLUMN user_signature_content_format ENUM('','bb','md') NOT NULL DEFAULT '' AFTER user_signature_content;
|
||||
SQL);
|
||||
$conn->execute(<<<SQL
|
||||
UPDATE msz_users
|
||||
SET user_about_content_format = IF(user_about_parser = 2, 'md', IF(user_about_parser = 1, 'bb', '')),
|
||||
user_signature_content_format = IF(user_signature_parser = 2, 'md', IF(user_signature_parser = 1, 'bb', ''));
|
||||
SQL);
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_users
|
||||
DROP COLUMN user_about_parser,
|
||||
DROP COLUMN user_signature_parser;
|
||||
SQL);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue