Repository: directus/directus
File: app/src/modules/settings/routes/data-model/field-detail/field-detail-advanced/field-detail-advanced-schema.vue (Vue)

Code before:
const { onUpdateOptions, onUpdateValue } = useOnUpdate();

const hasCreateUpdateTriggers = computed(() => {
	return ['uuid', 'date', 'time', 'dateTime', 'timestamp'].includes(type.value) && localType.value !== 'file';
});

const isAlias = computed(() => {
	return !fieldDetailStore.field.schema;
});

const isPrimaryKey = computed(() => {
	return fieldDetailStore.field.schema?.is_primary_key === true;
});

const isGenerated = computed(() => {
	return fieldDetailStore.field.schema?.is_generated;
});

const isSearchableType = computed(() => {
	// exclude alias fields (o2m, m2m, m2a) as they don't store searchable data
	if (type.value === 'alias') return false;

	// exclude relational fields except m2o, which stores foreign keys that are typically not useful for search
	if (localType.value && localType.value !== 'standard') return false;

	const searchableTypes = ['text', 'string', 'integer', 'bigInteger', 'float', 'decimal', 'uuid'];
	return searchableTypes.includes(type.value);
});

function useOnCreate() {
	const onCreateSpecials = ['uuid', 'user-created', 'role-created', 'date-created'];

	const onCreateOptions = computed(() => {
		if (type.value === 'uuid') {
			const options = [
				{
					text: t('do_nothing'),
					value: null,
				},
				{
					text: t('generate_and_save_uuid'),
					value: 'uuid',
				},
				{
					text: t('save_current_user_id'),
					value: 'user-created',
				},
				{
					text: t('save_current_user_role'),
					value: 'role-created',
				},

Review comment (refactor):
Would be great to move this const [here](https://github.com/PHILLIPS71/directus/blob/90160fd5136e88d15c1e6ed2618e33c344d1f5f7/packages/constants/src/fields.ts)  

Code after:
const { onCreateOptions, onCreateValue } = useOnCreate();
const { onUpdateOptions, onUpdateValue } = useOnUpdate();

const hasCreateUpdateTriggers = computed(() => {
	return ['uuid', 'date', 'time', 'dateTime', 'timestamp'].includes(type.value) && localType.value !== 'file';
});

const isAlias = computed(() => {
	return !fieldDetailStore.field.schema;
});

const isPrimaryKey = computed(() => {
	return fieldDetailStore.field.schema?.is_primary_key === true;
});

const isGenerated = computed(() => {
	return fieldDetailStore.field.schema?.is_generated;
});

const isSearchableType = computed(() => {
	// exclude alias fields (o2m, m2m, m2a) as they don't store searchable data
	if (type.value === 'alias') return false;

	// exclude relational fields except m2o, which stores foreign keys that are typically not useful for search
	if (localType.value && localType.value !== 'standard') return false;

	return SEARCHABLE_TYPES.includes(type.value);
});

function useOnCreate() {
	const onCreateSpecials = ['uuid', 'user-created', 'role-created', 'date-created'];

	const onCreateOptions = computed(() => {
		if (type.value === 'uuid') {
			const options = [
				{
					text: t('do_nothing'),
					value: null,
				},
				{
					text: t('generate_and_save_uuid'),
					value: 'uuid',
				},
				{
					text: t('save_current_user_id'),
					value: 'user-created',
				},
				{
					text: t('save_current_user_role'),
					value: 'role-created',
				},