<commit_before><?php

namespace App\Container\Database;

use DB, Account, Config, Direct;

class Migrations{

	public static function install(){
		//$name, $type, $default = null, $not_null = true, $auto_increment = false)
		$db = new DB();

		$db->clearOut(); // delete database

		// (item, item_cats, cats, users, messages)
		$db->createTable('users', [
			new PID(),
			new Timestamp(),
			new Varchar('name'),
			new Varchar('surname'),
			new Row('username', 'varchar', null, true, false, 'UNIQUE'),
			new Varchar('mail'),
			new Varchar('password'),
		]);

		$db->createTable('items', [
			new PID(),
			new Timestamp(),
			new Varchar('title'),
			new Integer('user_id'),
			new Varchar('description'),
		]);

		$db->createTable('item_category', [
			new PID(),
			new Integer('item_id'),
			new Integer('category_id'),
		]);

		$db->createTable('categories', [
			new PID(),
			new Varchar('name'),
		]);

		$db->createTable('messages', [
			new PID(),
			new Integer('from'),
			new Integer('to'),
			new Row('message', 'text'),
		]);


		self::populate();


		return [$db->tableStatus];
	}

	public static function populate(){
		$db = new DB();

		$adminId = Account::register('admin', 'admin', 'admin', '<EMAIL>');


		$db->insert('categories', [
			[
				'name' => 'Sport',
			],
			[
				'name' => 'Hage',
			],
			[
				'name' => 'Stue',
			],
			[
				'name' => 'Kjøkken',
			],
			[
				'name' => 'Barn',
			],
			[
				'name' => 'Natur',
			],
		]);

		$db->createTable('item_category', [
			new PID(),
			new Integer('item_id'),
			new Integer('category_id'),
		]);

		$db->insert('item_category', [
			[
				'item_id' => 1,
				'category_id' => 1,
			],
			[
				'item_id' => 1,
				'category_id' => 6,
			],
		]);

	}
}<commit_msg>migration items<commit_after><?php

namespace App\Container\Database;

use DB, Account, Config, Direct;

class Migrations{

	public static function install(){
		//$name, $type, $default = null, $not_null = true, $auto_increment = false)
		$db = new DB();

		$db->clearOut(); // delete database

		// (item, item_cats, cats, users, messages)
		$db->createTable('users', [
			new PID(),
			new Timestamp(),
			new Varchar('name'),
			new Varchar('surname'),
			new Row('username', 'varchar', null, true, false, 'UNIQUE'),
			new Varchar('mail'),
			new Varchar('password'),
		]);

		$db->createTable('items', [
			new PID(),
			new Timestamp(),
			new Varchar('title'),
			new Integer('user_id'),
			new Varchar('description'),
		]);

		$db->createTable('item_category', [
			new PID(),
			new Integer('item_id'),
			new Integer('category_id'),
		]);

		$db->createTable('categories', [
			new PID(),
			new Varchar('name'),
		]);

		$db->createTable('messages', [
			new PID(),
			new Integer('from'),
			new Integer('to'),
			new Row('message', 'text'),
		]);


		self::populate();


		return [$db->tableStatus];
	}

	public static function populate(){
		$db = new DB();

		$adminId = Account::register('admin', 'admin', 'admin', '<EMAIL>');


		$db->insert('categories', [
			[
				'name' => 'Sport',
			],
			[
				'name' => 'Hage',
			],
			[
				'name' => 'Stue',
			],
			[
				'name' => 'Kjøkken',
			],
			[
				'name' => 'Barn',
			],
			[
				'name' => 'Natur',
			],
		]);

		$db->insert('items', [
			[
				'title' => 'Sykkel gis bort',
				'user_id' => 1,
				'description' => 'Jeg vil gjerne gi bort min shitty sykkel...',
			]
		]);

		$db->insert('item_category', [
			[
				'item_id' => 1,
				'category_id' => 1,
			],
			[
				'item_id' => 1,
				'category_id' => 6,
			],
		])

	}
}
{'fraction_non_alphanumeric': 0.21890827236916152, 'fraction_numerical': 0.0025323579065841305, 'mean_word_length': 2.976510067114094, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 48, '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': '5655028', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1314, 'n_words': 270}