<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231227131121 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$connection = $this->connection;
//cheking if user is already exist
$existingRecordOfUser = $connection->fetchAssociative('SELECT * FROM `user` WHERE `username` = :username', ['username' => 'super_admin']);
//add if not
if (!$existingRecordOfUser) {
$this->addSql('INSERT INTO `user` (`username`, `contact_name`, `email`, `password`, `status`, `created_at`, `deleted_at`, `firstname`, `lastname`, `phone`, `timezone`, `user_type`, `user_role_type`, `ip_address`, `os_name`, `browser_name`, `browser_version`, `area`, `city`, `is_active`, `is_verify`, `country`, `slug`, `gender`, `state`, `parent_id`, `styles`, `dob`, `address`) VALUES
("super_admin", "admin contact","admin@gmail.com", "$2y$13$r.0WjK4JbMM6QfbLOfk6cebanP0faMp9o2OuWJruVfNSIv0YvmY36", "1", "2023-10-06 11:49:55", NULL, "admin", "admin", "9999911111", "-12:00", "0", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 0, "0", NULL, NULL)');
}
//cheking if role is already exist
$existingRecordOfRole = $connection->fetchAssociative('SELECT * FROM `roles` WHERE `role_slug` = :role_slug', ['role_slug' => 'super_admin']);
//add if not
if (!$existingRecordOfRole) {
$this->addSql('INSERT INTO `roles` ( `role`, `role_title`, `parent_id`, `role_slug`, `is_deleted`, `created_at`, `updated_at`, `deleted_at`, `is_admin`) VALUES
("Super Admin", "Super Admin", 1, "super_admin", 0, "2023-10-30 13:26:24", "2023-10-30 13:26:24", NULL, 0)');
}
}
public function down(Schema $schema): void
{
}
}