feat: leveldb migrations tool

feat: migration tools for sqlite
This commit is contained in:
ppe
2022-06-29 11:23:33 +02:00
committed by just_ppe
parent 74e8696838
commit 83c68df5df
13 changed files with 141 additions and 213 deletions

31
tools/migrate.ts Normal file
View File

@@ -0,0 +1,31 @@
/* eslint-disable */
import Arweave from 'arweave';
import {defaultCacheOptions, defaultWarpGwOptions, LoggerFactory, WarpFactory} from '../src';
LoggerFactory.INST.logLevel('debug');
async function main() {
const arweave = Arweave.init({
host: 'arweave.net', // Hostname or IP address for a Arweave host
port: 443, // Port
protocol: 'https', // Network protocol http or https
timeout: 60000, // Network request timeouts in milliseconds
logging: false // Enable network request logging
});
const warp = WarpFactory.warpGw(arweave, defaultWarpGwOptions, {
...defaultCacheOptions,
dbLocation: './tools/.leveldb'
});
const result = await warp.migrationTool.migrateSqlite("./tools/sqlite/contracts-3008.sqlite");
console.log(result);
const dump = await warp.stateEvaluator.dumpCache();
console.log(dump);
}
main().catch((e) => console.error(e));