Skip to content

Commit

Permalink
Expand icon column of tags table to store extended emoji (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
vokomarov authored Nov 18, 2023
2 parents 507f38c + b64844f commit 715261d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions app/migrations/20231118.173536_0_expand_tags_icon_column.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace App;

use Cycle\Migrations\Migration;

class ExpandTagsIconColumnMigration extends Migration
{
public function up(): void
{
$this->table('tags')
->alterColumn('icon', 'string', [
'nullable' => true,
'default' => null,
'size' => 4,
])
->update();
}

public function down(): void
{
$this->table('tags')
->alterColumn('icon', 'string', [
'nullable' => true,
'default' => null,
'size' => 2,
])
->update();
}
}
2 changes: 1 addition & 1 deletion app/src/Database/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Tag
#[ORM\Column(type: 'integer', name: 'user_id')]
public int $userId = 0;

#[ORM\Column(type: 'string(2)', nullable: true)]
#[ORM\Column(type: 'string(4)', nullable: true)]
public string|null $icon = null;

#[ORM\Column(type: 'string', nullable: true)]
Expand Down

0 comments on commit 715261d

Please sign in to comment.