hasTable('mail_blocks_shares')) { return null; } $table = $schema->createTable('mail_blocks_shares'); $table->addColumn('id', Types::INTEGER, [ 'autoincrement' => true, 'notnull' => true, ]); $table->addColumn('type', Types::STRING, [ 'notnull' => true, 'length' => 64, ]); $table->addColumn('share_with', Types::STRING, [ 'notnull' => true, 'length' => 64, ]); $table->addColumn('text_block_id', Types::INTEGER, [ 'notnull' => true, ]); $table->setPrimaryKey(['id']); $table->addUniqueIndex(['text_block_id', 'share_with'], 'mail_blocks_shares_tbid_sw_idx'); if ($schema->hasTable('mail_text_blocks')) { $table->addForeignKeyConstraint( $schema->getTable('mail_text_blocks'), ['text_block_id'], ['id'], [ 'onDelete' => 'CASCADE', ] ); } return $schema; } }