<commit_before>use strict;
use warnings;

package Qublog::Model::TaskLog;
use Jifty::DBI::Schema;

=head1 NAME

Qublog::Model::TaskLog - a log of changes to a task

=head1 SYNOPSIS

  # Please add one...

=head1 DESCRIPTION

Each L<Qublog::Model::Task> tracks it's history through task log objects. Each task log object is a message with a number of L<Qublog::Model::TaskChange> objects describing individual field updates.

=head1 SCHEMA

=head2 task

This is the L<Qublog::Model::Task> to which this log belongs.

=head2 log_type

This describes the type of log message this is. It is one of the following:

=over

=item create

Each task should have exactly one of these. This gives information about the task's creation.

=item update

Every time a field is updated on a task, one of these logs is added.

=item note

This is used to indicate that a L</comment> is present and is generally used for any non-create/non-update change.

=back

=head2 created_on

This is the timestamp the logged action took place.

=head2 message

DEPRECATED. Removed in 0.2.4 and was never used.

=head2 comment

This is the comment attached to the logged action.

=cut

use Qublog::Record schema {
    column task =>
        references Qublog::Model::Task,
        label is 'Task',
        is mandatory,
        is immutable,
        ;

    column log_type =>
        type is 'text',
        label is 'Type',
        valid_values are qw/ 
            create
            update
            note
        /,
        is mandatory,
        ;

    column created_on =>
        type is 'datetime',
        label is 'Created on',
        is mandatory,
        filters are qw/ Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime /,
        ;

    column message =>
        type is 'text',
        label is 'Message',
        till '0.2.4',
        ;

    column comment =>
        references Qublog::Model::Comment,
        label is 'Message',
        since '0.2.4',
        ;
};

=head1 METHODS

=head2 since

This model was added with the 0.1.4 database revision.

=cut

# Your model-specific methods go here.
sub since { '0.1.4' }

=head1 TRIGGERS

=head2 before_create

Sets the L</created_on> timestamp.

=cut

sub before_create {<commit_msg>Added a missing relationship column from task_log -> task_changes.<commit_after>use strict;
use warnings;

package Qublog::Model::TaskLog;
use Jifty::DBI::Schema;

=head1 NAME

Qublog::Model::TaskLog - a log of changes to a task

=head1 SYNOPSIS

  # Please add one...

=head1 DESCRIPTION

Each L<Qublog::Model::Task> tracks it's history through task log objects. Each task log object is a message with a number of L<Qublog::Model::TaskChange> objects describing individual field updates.

=head1 SCHEMA

=head2 task

This is the L<Qublog::Model::Task> to which this log belongs.

=head2 log_type

This describes the type of log message this is. It is one of the following:

=over

=item create

Each task should have exactly one of these. This gives information about the task's creation.

=item update

Every time a field is updated on a task, one of these logs is added.

=item note

This is used to indicate that a L</comment> is present and is generally used for any non-create/non-update change.

=back

=head2 created_on

This is the timestamp the logged action took place.

=head2 message

DEPRECATED. Removed in 0.2.4 and was never used.

=head2 comment

This is the comment attached to the logged action.

=cut

use Qublog::Record schema {
    column task =>
        references Qublog::Model::Task,
        label is 'Task',
        is mandatory,
        is immutable,
        ;

    column log_type =>
        type is 'text',
        label is 'Type',
        valid_values are qw/ 
            create
            update
            note
        /,
        is mandatory,
        ;

    column created_on =>
        type is 'datetime',
        label is 'Created on',
        is mandatory,
        filters are qw/ Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime /,
        ;

    column message =>
        type is 'text',
        label is 'Message',
        till '0.2.4',
        ;

    column comment =>
        references Qublog::Model::Comment,
        label is 'Message',
        since '0.2.4',
        ;

    column task_changes =>
        references Qublog::Model::TaskChangeCollection by 'task_log';
};

=head1 METHODS

=head2 since

This model was added with the 0.1.4 database revision.

=cut

# Your model-specific methods go here.
sub since { '0.1.4' }

=head1 TRIGGERS

=head2 before_create

Sets the L</created_on> timestamp.

=cut

sub before_create {
{'fraction_non_alphanumeric': 0.08432949358835036, 'fraction_numerical': 0.012171267115844382, 'mean_word_length': 2.6264775413711585, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2615843', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1394, 'n_words': 549}