Skip to content

Commit

Permalink
chore: new mirgration files
Browse files Browse the repository at this point in the history
  • Loading branch information
sabineschaller committed Sep 12, 2023
1 parent 7be2879 commit 13b4524
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
exports.up = function (knex) {
return knex.schema.createTable('assets', function (table) {
table.uuid('id').notNullable().primary()

// TigerBeetle account 2 byte ledger field representing account's asset
table.specificType('ledger', 'smallserial').notNullable().unique()
table.string('code').notNullable()
table.smallint('scale').unsigned().notNullable()

table.bigInteger('withdrawalThreshold').nullable()
table.bigInteger('liquidityThreshold').nullable()

table.timestamp('createdAt').defaultTo(knex.fn.now())
table.timestamp('updatedAt').defaultTo(knex.fn.now())

table.unique(['code', 'scale'])

table.index(['createdAt', 'id'])

table.check('?? <= 255', ['scale'])
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('assets')
}
exports.up = function (knex) {
return knex.schema.createTable('assets', function (table) {
table.uuid('id').notNullable().primary()

// TigerBeetle account 2 byte ledger field representing account's asset
table.specificType('ledger', 'smallserial').notNullable().unique()
table.string('code').notNullable()
table.smallint('scale').unsigned().notNullable()

table.bigInteger('withdrawalThreshold').nullable()
table.bigInteger('liquidityThreshold').nullable()

table.timestamp('createdAt').defaultTo(knex.fn.now())
table.timestamp('updatedAt').defaultTo(knex.fn.now())

table.unique(['code', 'scale'])

table.index(['createdAt', 'id'])

table.check('?? <= 255', ['scale'])
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('assets')
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
exports.up = function (knex) {
return knex.schema.createTable('peers', function (table) {
table.uuid('id').notNullable().primary()

table.uuid('assetId').notNullable()
table.foreign('assetId').references('assets.id')

table.bigInteger('maxPacketAmount').nullable()
table.bigInteger('liquidityThreshold').nullable()

table.string('staticIlpAddress').notNullable().index()

table.string('outgoingToken').nullable()
table.string('outgoingEndpoint').nullable()

table.string('name').nullable()

table.timestamp('createdAt').defaultTo(knex.fn.now())
table.timestamp('updatedAt').defaultTo(knex.fn.now())

table.index(['createdAt', 'id'])
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('peers')
}
exports.up = function (knex) {
return knex.schema.createTable('peers', function (table) {
table.uuid('id').notNullable().primary()

table.uuid('assetId').notNullable()
table.foreign('assetId').references('assets.id')

table.bigInteger('maxPacketAmount').nullable()
table.bigInteger('liquidityThreshold').nullable()

table.string('staticIlpAddress').notNullable().index()

table.string('outgoingToken').nullable()
table.string('outgoingEndpoint').nullable()

table.string('name').nullable()

table.timestamp('createdAt').defaultTo(knex.fn.now())
table.timestamp('updatedAt').defaultTo(knex.fn.now())

table.index(['createdAt', 'id'])
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('peers')
}

0 comments on commit 13b4524

Please sign in to comment.