Originally created by @virulentum on GitHub (Apr 17, 2020).
Is there any way to perform two migrations at once: first a lightweight one and second a heavyweight one?
For example, I have only three models in an app: "Model V1", "Model V20", "Model V21".
Current version of database may be different (V10, V11, ..., V20)
I would like to make migration from current to V20 (lightweight) and after that make migration from V20 to V21 (heavyweight).
I can do that in two step by adding two storages, but I would like to do it at once
Could you help me to solve this problem?
Originally created by @virulentum on GitHub (Apr 17, 2020).
Is there any way to perform two migrations at once: first a lightweight one and second a heavyweight one?
For example, I have only three models in an app: "Model V1", "Model V20", "Model V21".
Current version of database may be different (V10, V11, ..., V20)
I would like to make migration from current to V20 (lightweight) and after that make migration from V20 to V21 (heavyweight).
I can do that in two step by adding two storages, but I would like to do it at once
Could you help me to solve this problem?
Not with the built-in methods. Tracking the versioning for such cases means your app needs to manage the version data somewhere else, so you will have to write one yourself.
@JohnEstropia commented on GitHub (Apr 18, 2020):
Not with the built-in methods. Tracking the versioning for such cases means your app needs to manage the version data somewhere else, so you will have to write one yourself.
So, it means that I cannot do something like: let sqlStore = SQLiteStore(fileURL: url, migrationMappingProviders: [ mappingProvider1, mappingProvider2 ])
where mappingProvider1 for lightweight migration and mappingProvider2 for heavyweight migration.
Is it true?
@virulentum commented on GitHub (Apr 18, 2020):
So, it means that I cannot do something like:
`let sqlStore = SQLiteStore(fileURL: url, migrationMappingProviders: [ mappingProvider1, mappingProvider2 ])`
where `mappingProvider1` for lightweight migration and `mappingProvider2` for heavyweight migration.
Is it true?
@virulentum Sorry, I think I misunderstood what you were trying to do.
If you are just trying to mix light and heavy migrations as part of the MigrationChain steps, then yes, the migrationMappingProviders will let you do that.
@JohnEstropia commented on GitHub (Apr 18, 2020):
@virulentum Sorry, I think I misunderstood what you were trying to do.
If you are just trying to mix light and heavy migrations as part of the `MigrationChain` steps, then yes, the `migrationMappingProviders` will let you do that.
@JohnEstropia, well, it sounds good, but I have trouble with creating lightweight mapping provider, because I have only models V1, V20 and V21. How can I inform CoreStore, that a mapping provider is for a lightweight migration?
@virulentum commented on GitHub (Apr 18, 2020):
@JohnEstropia, well, it sounds good, but I have trouble with creating lightweight mapping provider, because I have only models V1, V20 and V21. How can I inform CoreStore, that a mapping provider is for a lightweight migration?
@virulentum As long as the migrationChain parameter of the DataStack initializer contains the mapping for each step in the progressive migration, anything not explicitly included in the storage migrationMappingProviders will automatically attempt to use lightweight migration.
@JohnEstropia commented on GitHub (Apr 18, 2020):
@virulentum As long as the `migrationChain` parameter of the `DataStack` initializer contains the mapping for each step in the progressive migration, anything not explicitly included in the storage `migrationMappingProviders` will automatically attempt to use lightweight migration.
For version migrations present in the DataStack's MigrationChain but not handled by any of the SQLiteStore's migrationMappingProviders array, CoreStore will automatically try to use InferredSchemaMappingProvider as fallback
@JohnEstropia commented on GitHub (Apr 18, 2020):
See: https://github.com/JohnEstropia/CoreStore#custom-migrations
> For version migrations present in the `DataStack`'s `MigrationChain` but not handled by any of the `SQLiteStore`'s `migrationMappingProviders` array, CoreStore will automatically try to use `InferredSchemaMappingProvider` as fallback
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @virulentum on GitHub (Apr 17, 2020).
Is there any way to perform two migrations at once: first a lightweight one and second a heavyweight one?
For example, I have only three models in an app: "Model V1", "Model V20", "Model V21".
Current version of database may be different (V10, V11, ..., V20)
I would like to make migration from current to V20 (lightweight) and after that make migration from V20 to V21 (heavyweight).
I can do that in two step by adding two storages, but I would like to do it at once
Could you help me to solve this problem?
@JohnEstropia commented on GitHub (Apr 18, 2020):
Not with the built-in methods. Tracking the versioning for such cases means your app needs to manage the version data somewhere else, so you will have to write one yourself.
@virulentum commented on GitHub (Apr 18, 2020):
So, it means that I cannot do something like:
let sqlStore = SQLiteStore(fileURL: url, migrationMappingProviders: [ mappingProvider1, mappingProvider2 ])where
mappingProvider1for lightweight migration andmappingProvider2for heavyweight migration.Is it true?
@JohnEstropia commented on GitHub (Apr 18, 2020):
@virulentum Sorry, I think I misunderstood what you were trying to do.
If you are just trying to mix light and heavy migrations as part of the
MigrationChainsteps, then yes, themigrationMappingProviderswill let you do that.@virulentum commented on GitHub (Apr 18, 2020):
@JohnEstropia, well, it sounds good, but I have trouble with creating lightweight mapping provider, because I have only models V1, V20 and V21. How can I inform CoreStore, that a mapping provider is for a lightweight migration?
@JohnEstropia commented on GitHub (Apr 18, 2020):
@virulentum As long as the
migrationChainparameter of theDataStackinitializer contains the mapping for each step in the progressive migration, anything not explicitly included in the storagemigrationMappingProviderswill automatically attempt to use lightweight migration.@JohnEstropia commented on GitHub (Apr 18, 2020):
See: https://github.com/JohnEstropia/CoreStore#custom-migrations
@virulentum commented on GitHub (Apr 19, 2020):
@JohnEstropia thank you very much for your answer!