<commit_before><?php

use yii\db\Schema;
use yii\db\Migration;

class m150626_093838_create_user_table extends Migration
{
    public function up() {
        $this->createTable('user', [
            'id' => Schema::TYPE_PK,
            'username' => Schema::TYPE_STRING . ' NOT NULL UNIQUE',
            'password_hash' => Schema::TYPE_STRING . ' NOT NULL',
            'auth_key' => Schema::TYPE_STRING,
            'is_admin' => Schema::TYPE_BOOLEAN . ' DEFAULT FALSE',
            'organizer_id' => Schema::TYPE_INTEGER,
            'created_at' => Schema::TYPE_DATETIME,
            'updated_at' => Schema::TYPE_DATETIME
        ]);

        $this->addForeignKey('user_organizer_id', 'user', 'organizer_id', 'organizer', 'id', $delete = 'CASCADE');
    }

    public function down() {
        $this->dropTable('user');<commit_msg>Set user->organizer to null when organizer is deleted<commit_after><?php

use yii\db\Schema;
use yii\db\Migration;

class m150626_093838_create_user_table extends Migration
{
    public function up() {
        $this->createTable('user', [
            'id' => Schema::TYPE_PK,
            'username' => Schema::TYPE_STRING . ' NOT NULL UNIQUE',
            'password_hash' => Schema::TYPE_STRING . ' NOT NULL',
            'auth_key' => Schema::TYPE_STRING,
            'is_admin' => Schema::TYPE_BOOLEAN . ' DEFAULT FALSE',
            'organizer_id' => Schema::TYPE_INTEGER,
            'created_at' => Schema::TYPE_DATETIME,
            'updated_at' => Schema::TYPE_DATETIME
        ]);

        $this->addForeignKey('user_organizer_id', 'user', 'organizer_id', 'organizer', 'id', $delete='SET NULL');
    }

    public function down() {
        $this->dropTable('user');
{'fraction_non_alphanumeric': 0.14997070884592853, 'fraction_numerical': 0.014059753954305799, 'mean_word_length': 2.7955555555555556, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '6952609', 'n_tokens_mistral': 549, 'n_tokens_neox': 534, 'n_words': 100}