You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 1, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+13-6Lines changed: 13 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -173,28 +173,35 @@ Each migration must follow this API. It must export an object in its `index.js`
173
173
*`migrate` (function) - Function that performs the migration (see signature of this function below)
174
174
*`revert` (function) - If defined then this function will revert the migration to the previous version. Otherwise it is assumed that it is not possible to revert this migration.
175
175
176
-
#### `.migrate(repoPath, repoOptions, isBrowser)`
176
+
#### `.migrate(repoPath, repoOptions)`
177
177
178
178
_Do not confuse this function with the `require('ipfs-repo-migrations').migrate()` function that drives the whole migration process!_
179
179
180
180
Arguments:
181
181
*`repoPath` (string) - absolute path to the root of the repo
182
182
*`repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct a datastore instance.
183
-
*`isBrowser` (bool) - indicates if the migration is run in a browser environment (as opposed to NodeJS)
184
183
185
-
#### `.revert(repoPath, repoOptions, isBrowser)`
184
+
#### `.revert(repoPath, repoOptions)`
186
185
187
186
_Do not confuse this function with the `require('ipfs-repo-migrations').revert()` function that drives the whole backward migration process!_
188
187
189
188
Arguments:
190
189
*`repoPath` (string) - path to the root of the repo
191
190
*`repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct the datastore instance.
192
-
*`isBrowser` (bool) - indicates if the migration is run in a browser environment (as opposed to NodeJS)
193
191
194
192
### Browser vs. NodeJS environments
195
193
196
-
The migration might need to distinguish in which environment it runs (browser vs. NodeJS). For this reason there is an argument
197
-
`isBrowser` passed to migrations functions. But with simple migrations it should not be necessary to distinguish between
194
+
The migration might need to perform specific tasks in browser or NodeJS environment. In such a case create
195
+
migration file `/migrations/migration-<number>/index_browser.js` which have to follow the same API is described before.
196
+
Then add entry in `package.json` to the `browser` field as follow:
log(`An exception was raised during execution of migration. Setting the repo's version to last successfully migrated version: ${lastSuccessfullyMigratedVersion}`)
log(`An exception was raised during execution of migration. Setting the repo's version to last successfully reverted version: ${lastSuccessfullyRevertedVersion}`)
0 commit comments