Moved forum signatures into dedicated table.
This commit is contained in:
parent
d1173c6e0f
commit
8bb2400d3f
11 changed files with 242 additions and 103 deletions
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
use Index\Db\DbConnection;
|
||||
use Index\Db\Migration\DbMigration;
|
||||
|
||||
final class MovedForumSignatureToDedicatedTable_20250208_213207 implements DbMigration {
|
||||
public function migrate(DbConnection $conn): void {
|
||||
$conn->execute(<<<SQL
|
||||
CREATE TABLE msz_forum_signatures (
|
||||
user_id INT UNSIGNED NOT NULL,
|
||||
signature_body TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci',
|
||||
signature_body_format ENUM('','bb','md') NOT NULL COLLATE 'ascii_general_ci',
|
||||
signature_created TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
PRIMARY KEY (user_id),
|
||||
CONSTRAINT forum_signatures_users_foreign
|
||||
FOREIGN KEY (user_id)
|
||||
REFERENCES msz_users (user_id)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
) COLLATE='utf8mb4_bin';
|
||||
SQL);
|
||||
|
||||
$conn->execute(<<<SQL
|
||||
INSERT INTO msz_forum_signatures
|
||||
SELECT user_id, user_signature_content, user_signature_content_format, NOW()
|
||||
FROM msz_users
|
||||
WHERE user_signature_content IS NOT NULL
|
||||
AND TRIM(user_signature_content) <> ''
|
||||
SQL);
|
||||
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_users
|
||||
DROP COLUMN user_signature_content,
|
||||
DROP COLUMN user_signature_content_format;
|
||||
SQL);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue