Current implementation always parse all of sql files, so may require a lot of time and memory if there are too many files or too big files in directory. But, in most of cases, we only need to parse 1~3 files because sort byId does not need content of files, it needs only the name of files.
So, I think it is better to parse sql files only when we need content of files.
Some migration sources are not supported to open/parse lazily in this PR.
HttpFileSystemMigrationSource,FileMigrationSource and EmbedFileSystemMigrationSource are supported, MemoryMigrationSource,AssetMigrationSource and PackrBox are not supported.
I don't think that's a problem because I guess most users don't use the latter migration sources.
I believe lazy loading should be the default behavior, but I made it optional with SetLazyLoad(true) to keep backward compatibility.
Current implementation always parse all of sql files, so may require a lot of time and memory if there are too many files or too big files in directory. But, in most of cases, we only need to parse 1~3 files because sort
byId
does not need content of files, it needs only the name of files. So, I think it is better to parse sql files only when we need content of files.Some migration sources are not supported to open/parse lazily in this PR.
HttpFileSystemMigrationSource
,FileMigrationSource
andEmbedFileSystemMigrationSource
are supported,MemoryMigrationSource
,AssetMigrationSource
andPackrBox
are not supported.I don't think that's a problem because I guess most users don't use the latter migration sources.
I believe lazy loading should be the default behavior, but I made it optional with
SetLazyLoad(true)
to keep backward compatibility.ref: https://github.com/rubenv/sql-migrate/issues/203