diff --git a/migrations/20260917140000_add_user_avatar.php b/migrations/20260917140000_add_user_avatar.php deleted file mode 100644 index 7bffd78..0000000 --- a/migrations/20260917140000_add_user_avatar.php +++ /dev/null @@ -1,32 +0,0 @@ -table('users', function (Blueprint $table): void { - $table->string('avatar_path', 255)->default(''); - $table->string('avatar_mime', 100)->default(''); - }); - } - - public function down(): void - { - $this->table('users', function (Blueprint $table): void { - $table->dropColumn('avatar_path'); - $table->dropColumn('avatar_mime'); - }); - } -} diff --git a/migrations/20260919000000_add_user_meta_telegram_field.php b/migrations/20260919000000_add_user_meta_telegram_field.php new file mode 100644 index 0000000..f883023 --- /dev/null +++ b/migrations/20260919000000_add_user_meta_telegram_field.php @@ -0,0 +1,50 @@ + 'telegram', + 'label' => 'Telegram', + 'type' => 'string', + 'description' => 'Профиль Telegram в формате @nickname', + ], + ]; + public function up(): void + { + foreach (self::META_FIELDS as $field) { + $this->statement( + 'INSERT INTO user_fields (field_key, label, type, description, sort, created_at, updated_at) + VALUES (:field_key, :label, :type, :description, :sort, :created_at, :updated_at)', + [ + 'field_key' => $field['field_key'], + 'label' => $field['label'], + 'type' => $field['type'], + 'description' => $field['description'], + 'sort' => 0, + 'created_at' => $this->now(), + 'updated_at' => $this->now(), + ] + ); + } + } + + public function down(): void + { + foreach (self::META_FIELDS as $field) { + $this->statement( + 'DELETE FROM user_fields WHERE field_key = :field_key', + ['field_key' => $field['field_key']] + ); + } + } +}