Added Nintendo Switch friend code profile field.

This commit is contained in:
flash 2018-12-07 19:02:55 +01:00
parent 0a417b75af
commit 418ab0fcb2
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,20 @@
<?php
namespace Misuzu\DatabaseMigrations\AddSwitchFriendcodeField;
use PDO;
function migrate_up(PDO $conn): void
{
$conn->exec("
ALTER TABLE `msz_users`
ADD COLUMN `user_ninswitch` VARCHAR(14) NOT NULL DEFAULT '' AFTER `user_steam`;
");
}
function migrate_down(PDO $conn): void
{
$conn->exec("
ALTER TABLE `msz_users`
DROP COLUMN `user_ninswitch`;
");
}

View file

@ -46,6 +46,11 @@ define('MSZ_USER_PROFILE_FIELDS', [
'regex' => '#^(?:https?://(?:www.)?steamcommunity.com/(?:id|profiles)/)?([a-zA-Z0-9_-]{2,100})/?$#u',
'link' => 'https://steamcommunity.com/id/%s',
],
'ninswitch' => [
'name' => 'Nintendo Switch',
'regex' => '#^(?:SW-)?([0-9]{4}-[0-9]{4}-[0-9]{4})$#u',
'format' => 'SW-%s',
],
'twitchtv' => [
'name' => 'Twitch.tv',
'regex' => '#^(?:https?://(?:www.)?twitch.tv/)?([0-9A-Za-z_]{3,25})/?$#u',