<?php

class m130306_074559_create_debugging_fake_accounts extends MyDbMigration
{

  private static $usernames = array('policeLow', 'policeMedium', 'policeHigh', 'civilianLow', 'civilianHigh');
  private static $passwords = array(
    '$2a$13$FeRF5NPqCmRqA/rnEASN1O3gYdzNJ.95Y9WbFqbeYHXAHJ8ecU4wa',
    '$2a$13$kEWCtUk39xYhzDBdeWqkRuMvy467kP/zQezCEbpUgbYJgBWQG8Rli',
    '$2a$13$8auLWEE4BYT2uRbwbdfbduzeB5M0C5ERqOkDzCqNb6Hyf06TTFLdm',
    '$2a$13$BwdJ/qrcT9gH5qntNOvgmOQaf.dYaYHpC4eUx4.2PwfIbkwQR477y',
    '$2a$13$NxOwc.e9Lhm/fEJ9iHTIkuPlTcVhWmviYFN/DZlNQwRE1kEimpAz.',
  );

	public function up()
	{

    foreach(self::$usernames as $index => $username)
    {
      $this->insert('users', array(
        'username' => $username,
        'password' => self::$passwords[$index],
        'email' => "{$username}@example.com",
        'first_name' => $username,
        'last_name' => $username,
        'superuser' => 0,
        'status' => 'active',
        'create_time' => new CDbExpression('NOW()'),
        'update_time' => new CDbExpression('NOW()'),
      ));
    }
  }

	public function down()
	{
    foreach(self::$usernames as $username)
      $this->delete('users', "username='{$username}'");
	}

}
