feat: implement activity logging for user actions and create activities table
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 44s

This commit is contained in:
Kaimbacher 2026-06-24 15:03:17 +02:00
commit 7e2f320b4f
12 changed files with 420 additions and 160 deletions

View file

@ -0,0 +1,25 @@
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);
}
}