<commit_before><?php

use app\models\User;
use yii\db\Migration;

class m130524_201442_init extends Migration
{
    public function safeUp()
    {
        // Create table
        $tableOptions = null;

        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable('{{%user}}', [
            'id' => $this->primaryKey(),
            'username' => $this->string()->notNull(),
            'auth_key' => $this->string(32)->notNull(),
            'password_hash' => $this->string()->notNull(),
            'email' => $this->string()->notNull(),

            'status' => $this->smallInteger()->notNull()->defaultValue(User::STATUS_ACTIVE),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
        ], $tableOptions);

        // Register admin user
        $user = new User();
        $user->username = 'admin';
        $user->email = '<EMAIL>';
        $user->setPassword('<PASSWORD>');
        $user->generateAuthKey();
        $user->save();

        $this->createTable('{{%item}}', [
            'id' => $this->primaryKey(),
            'type' => $this->smallInteger()->notNull(),
            'pin' => $this->smallInteger()->notNull(),
            'name' => $this->string()->notNull(),
            'title' => $this->string()->notNull(),
            'icon' => $this->string()->notNull(),
        ], $tableOptions);

        $this->createTable('{{%log}}', [
            'id' => $this->primaryKey(),
            'user_id' => $this->integer()->notNull(),
            'item_id' => $this->integer()->notNull(),
            'type' => $this->smallInteger()->notNull(),
            'value' => $this->smallInteger()->notNull(),
            'date' => $this->integer()->notNull(),
        ], $tableOptions);
    }

    public function safeDown()
    {
        $this->dropTable('{{%user}}');
        $this->dropTable('{{%item}}');
        $this->dropTable('{{%log}}');
    }
}
<commit_msg>Migration fixes<commit_after><?php

use app\models\User;
use yii\db\Migration;

class m130524_201442_init extends Migration
{
    public function safeUp()
    {
        $tableOptions = null;

        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable('{{%user}}', [
            'id' => $this->primaryKey(),
            'username' => $this->string()->notNull(),
            'auth_key' => $this->string(32)->notNull(),
            'password_hash' => $this->string()->notNull(),
            'email' => $this->string()->notNull(),

            'status' => $this->smallInteger()->notNull()->defaultValue(User::STATUS_ACTIVE),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
        ], $tableOptions);

        // Register admin user
        $user = new User();
        $user->username = 'admin';
        $user->email = '<EMAIL>';
        $user->setPassword('<PASSWORD>');
        $user->generateAuthKey();
        $user->save();

        $this->createTable('{{%item}}', [
            'id' => $this->primaryKey(),
            'type' => $this->smallInteger()->notNull(),
            'pin' => $this->smallInteger()->notNull(),
            'name' => $this->string()->notNull(),
            'updateInterval' => $this->float()->notNull()->defaultValue(0),
            'title' => $this->string()->notNull(),
            'icon' => $this->string()->notNull(),
        ], $tableOptions);

        $this->createTable('{{%log}}', [
            'id' => $this->primaryKey(),
            'type' => $this->smallInteger()->notNull(),
            'user_id' => $this->integer()->notNull(),
            'item_id' => $this->integer()->notNull(),
            'value' => $this->smallInteger()->notNull(),
            'date' => $this->integer()->notNull(),
        ], $tableOptions);
    }

    public function safeDown()
    {
        $this->dropTable('{{%user}}');
        $this->dropTable('{{%item}}');
        $this->dropTable('{{%log}}');
    }
}

{'fraction_non_alphanumeric': 0.22425409047160733, 'fraction_numerical': 0.007940327237728586, 'mean_word_length': 2.2451209992193597, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 153, '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': '6593809', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1223, 'n_words': 183}