Files
speckle-server/packages/server/modules/activitystream/migrations/20210616173000_stream_activity.js
T
2022-03-30 12:54:24 +03:00

24 lines
740 B
JavaScript

// /* istanbul ignore file */
exports.up = async (knex) => {
await knex.schema.createTable('stream_activity', (table) => {
// No foreign keys because the referenced objects may be deleted, but we want to keep their ids here in this table for future analysis
table.string('streamId', 10)
table.timestamp('time').defaultTo(knex.fn.now())
table.string('resourceType')
table.string('resourceId')
table.string('actionType')
table.string('userId')
table.jsonb('info')
table.string('message')
table.index(['streamId', 'time'])
table.index(['userId', 'time'])
table.index(['resourceId', 'time'])
})
}
exports.down = async (knex) => {
await knex.schema.dropTableIfExists('stream_activity')
}