All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 44s
25 lines
985 B
TypeScript
25 lines
985 B
TypeScript
import { BaseSchema } from '@adonisjs/lucid/schema';
|
|
|
|
export default class extends BaseSchema {
|
|
protected tableName = 'activities';
|
|
|
|
async up() {
|
|
this.schema.createTable(this.tableName, (table) => {
|
|
table.increments('id');
|
|
table.string('type').notNullable().index(); // 'dataset.uploaded', 'auth.login'
|
|
table.integer('user_id').unsigned().nullable().references('id').inTable('accounts').onDelete('SET NULL');
|
|
table.string('subject_type').nullable(); // manual morph: model name
|
|
table.bigInteger('subject_id').unsigned().nullable();
|
|
table.string('description').notNullable();
|
|
table.json('properties').nullable();
|
|
table.timestamp('created_at');
|
|
table.timestamp('updated_at');
|
|
table.index(['subject_type', 'subject_id'])
|
|
table.index('created_at')
|
|
});
|
|
}
|
|
|
|
async down() {
|
|
this.schema.dropTable(this.tableName);
|
|
}
|
|
}
|