'use strict'; var dbm; var type; var seed; /** * We receive the dbmigrate dependency from dbmigrate initially. * This enables us to not have to rely on NODE_PATH. */ exports.setup = function (options, seedLink) { dbm = options.dbmigrate; type = dbm.dataType; seed = seedLink; }; exports.up = async function (db) { await db.createTable('progress', { chain: { type: 'int', primaryKey: true }, block: 'int', // the latest block processed }) await db.createTable('eoa', { chain: { type: 'int', primaryKey: true }, address: { type: 'bytea', primaryKey: true}, vaulted: 'boolean', }) await db.createTable('tokenusage', { chain: { type: 'int', primaryKey: true }, eoa: { type: 'bytea', primaryKey: true}, token: { type: 'bytea', primaryKey: true}, touched: 'datetime', }) await db.createTable('orders', { chain: { type: 'int', primaryKey: true }, eoa: { type: 'bytea', primaryKey: true}, version: { type: 'smallint', primaryKey: true}, index: { type: 'int', primaryKey: true}, completed: { type: 'boolean', default: false}, spec: 'jsonb', status: 'jsonb', }) await db.createTable('execution', { id: { type: 'int', primaryKey: true, autoIncrement: true }, chain: 'int', eoa: 'bytea', version: 'smallint', index: 'int', status: 'jsonb', }) db.addIndex('execution', 'ordersindex', ['chain', 'eoa', 'version', 'index']) }; exports.down = async function (db) { await db.dropTable('progress') await db.dropTable('eoa') await db.dropTable('tokenusage') await db.dropTable('orders') await db.dropTable('execution') }; exports._meta = { "version": 1 };