Proper method for modifying a stream's field type configuration

emergingdzns - 1 week ago

I've got a stream and I defined one of the fields as a multiple field type with a relationship that was just plain dumb. I realized the error of my ways, but now I'm perplexed as to how to now create a migration that will modify the field type to point to the correct relationship. Can someone shed some light?

Answer

ryanthompson - 1 week ago

You can use normal migrations along the lines of this: https://pyrocms.com/documentation/streams-platform/latest#database/migrations/generating-migrations/default-migrations

$this->fields()->findBySlugAndNamespace('foo', 'bar')->setAttribute('config', $newConfig)->save();

ryanthompson - 1 week ago

You can use normal migrations along the lines of this: https://pyrocms.com/documentation/streams-platform/latest#database/migrations/generating-migrations/default-migrations

$this->fields()->findBySlugAndNamespace('foo', 'bar')->setAttribute('config', $newConfig)->save();