diff --git a/addons/default/visiosoft/profile-module/migrations/2021_10_07_090830_visiosoft.module.profile__create_utm_source_field.php b/addons/default/visiosoft/profile-module/migrations/2021_10_07_090830_visiosoft.module.profile__create_utm_source_field.php new file mode 100644 index 000000000..189d32c91 --- /dev/null +++ b/addons/default/visiosoft/profile-module/migrations/2021_10_07_090830_visiosoft.module.profile__create_utm_source_field.php @@ -0,0 +1,39 @@ +fields()->findBySlugAndNamespace('utm_source', 'users')) { + $field = $this->fields() + ->create( + [ + 'slug' => 'utm_source', + 'namespace' => 'users', + 'type' => 'anomaly.field_type.text', + 'name' => 'visiosoft.module.profile::field.utm_source.name', + 'locked' => false, + ] + ); + + $stream = $this->streams()->findBySlugAndNamespace('users', 'users'); + + $this->assignments() + ->create( + [ + 'field' => $field, + 'stream' => $stream, + ] + ); + } + } + + public function down() + { + if ($field = $this->fields()->findBySlugAndNamespace('utm_source', 'users')) { + $field->delete(); + } + } +}