| 306 | } |
| 307 | |
| 308 | const makeMigration = < |
| 309 | FromVersion extends IndexedDbVersion.AnyWithProps, |
| 310 | ToVersion extends IndexedDbVersion.AnyWithProps, |
| 311 | Error |
| 312 | >(options: { |
| 313 | readonly previous: |
| 314 | | IndexedDbSchema<FromVersion, ToVersion, Error> |
| 315 | | IndexedDbSchema<never, FromVersion, Error> |
| 316 | readonly fromVersion: FromVersion |
| 317 | readonly version: ToVersion |
| 318 | readonly migrate: ( |
| 319 | fromQuery: Transaction<FromVersion>, |
| 320 | toQuery: Transaction<ToVersion> |
| 321 | ) => Effect.Effect<void, Error> |
| 322 | }): IndexedDbSchema<FromVersion, ToVersion, Error> => { |
| 323 | // oxlint-disable-next-line typescript/no-extraneous-class |
| 324 | function Migration() {} |
| 325 | Object.setPrototypeOf(Migration, SchemaProto) |
| 326 | ;(Migration as any).previous = options.previous |
| 327 | ;(Migration as any).fromVersion = options.fromVersion |
| 328 | ;(Migration as any).version = options.version |
| 329 | ;(Migration as any).migrate = options.migrate |
| 330 | |
| 331 | return Migration as any |
| 332 | } |
| 333 | |
| 334 | const layer = <DatabaseName extends string>( |
| 335 | databaseName: DatabaseName, |