How to not migrate data that's already in the data store?

There is imported data (from RDB) in the data store that I don’t want to migrate and would like to import from RDB again, because I changed the data type of this data.
In the migration file I described this for the specific collection:

'<collection name>': collection = <!""!> none

When deploying this unfortunately results in a job fail:

Unable to load instance data. Error initializing dataset. Unknown property <...> found in dataset at <...>.

How to resolve this?

This means your migration ‘from’ model does not match the actual dataset that you are migrating. You will have to add this unknown property to your ‘from’ model in order to run the migration correctly.

If a collection has only one value, I wish that value to be migrated as a text:

The syntax to do this is a bit different from the application. Can anybody please help me achieve the following?

Migration.alan:

'Has Main Country': stategroup = switch $ .'Has Main Country' (
	|'No' = switch $ .'Countries'* (
		| none => 'No' ( )
		| node as $ => 'Yes' (
			'Country': text = $ .'Country'
		)
	)
	|'Yes' as $ = 'Yes' (
					'Country': text = $ .'Country'
	)
)

Hi Martinique,

This is not possible in the migration:
switch $ .'Countries'* (
| none => 'No' ( )
| node as $ => 'Yes' (
'Country': text = $ .'Country'
)
)

The trick is to do that in the from model and then use the output of that in the migration. You can use derived properties on the from model just like any other property as input for the migration.

We are working on a migration language that makes it possible to do most/all changes in the migration itself, but that is not available yet.

1 Like