db-migration icon indicating copy to clipboard operation
db-migration copied to clipboard

Add all supported types as shortcuts into the Migration Builder

Open viktorprogger opened this issue 2 years ago • 1 comments

Add shortcuts for all SchemaInterface::TYPE_* constants. For now we have to do smthng like this in migrations to add UUID columns instead of $b->uuidPk()->notNull():

    public function __construct(private ConnectionInterface $db)
    {
    }

    public function up(MigrationBuilder $b): void
    {
        $b->createTable('table_name', [
            'id' => $this->db->getSchema()->createColumn(SchemaInterface::TYPE_UUID_PK)->notNull(),
        ]);
    }

Task steps:

  • Find out all such types
  • Add corresponding methods to the MigrationBuilder class

viktorprogger avatar Nov 01 '23 11:11 viktorprogger

It remains to implement:

  • [ ] TYPE_UPK
  • [ ] TYPE_UBIGPK

vjik avatar Jan 06 '24 10:01 vjik

Use ColumnBuilder::* to create table columns

Tigrov avatar Jan 07 '25 08:01 Tigrov