<commit_before>#!/usr/bin/env perl
#
# Concatenate and echo the database schema diff that would upgrade the Media Cloud
# database to the latest schema version (no --import parameter).
#  *or*
# Upgrade the Media Cloud database to the latest schema version (--import parameter).
#
# Usage: ./script/run_with_carton.sh ./script/mediawords_upgrade_db.pl > schema-diff.sql
#    or: ./script/run_with_carton.sh ./script/mediawords_upgrade_db.pl --import

use strict;
use warnings;

BEGIN
{
    use FindBin;
    use lib "$FindBin::Bin/../lib";
}

use DBIx::Simple::MediaWords;
use MediaWords::DB;
use Modern::Perl "2013";
use MediaWords::CommonLibs;

use Getopt::Long;
use MediaWords::Pg::Schema;

sub main
{
    my $import = 0;    # script should import the diff directly instead of echoing it out

    my Readonly $usage = "Usage: $0 > schema-diff.sql\n   or: $0 --import";<commit_msg>Set the relative library path without using FindBin::Bin.<commit_after>#!/usr/bin/env perl
#
# Concatenate and echo the database schema diff that would upgrade the Media Cloud
# database to the latest schema version (no --import parameter).
#  *or*
# Upgrade the Media Cloud database to the latest schema version (--import parameter).
#
# Usage: ./script/run_with_carton.sh ./script/mediawords_upgrade_db.pl > schema-diff.sql
#    or: ./script/run_with_carton.sh ./script/mediawords_upgrade_db.pl --import

use strict;
use warnings;

BEGIN
{
    my $source_rt;

    BEGIN
    {
        use File::Basename;
        use File::Spec;
        use Cwd qw( realpath );

        my $file_dir = dirname( __FILE__ );

        $source_rt = "$file_dir" . "/..";
        $source_rt = realpath( File::Spec->canonpath( $source_rt ) );
    }
    use lib "$source_rt/lib";
}

use DBIx::Simple::MediaWords;
use MediaWords::DB;
use Modern::Perl "2013";
use MediaWords::CommonLibs;

use Getopt::Long;
use MediaWords::Pg::Schema;

sub main
{
    my $import = 0;    # script should import the diff directly instead of echoing it out

    my Readonly $usage = "Usage: $0 > schema-diff.sql\n   or: $0 --import";
{'fraction_non_alphanumeric': 0.125181246979217, 'fraction_numerical': 0.006766553890768487, 'mean_word_length': 3.519650655021834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '4017239', 'n_tokens_mistral': 703, 'n_tokens_neox': 670, 'n_words': 211}