This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Code sample to use Transactions | |
// Get the Entity Manager | |
$em = $this->getDoctrine()->getEntityManager(); | |
// Suspend the auto-commit | |
$em->getConnection()->beginTransaction(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace SymfonyLive\Mastermind\Adapters\Database; | |
use Doctrine\Common\Persistence\ManagerRegistry; | |
use Doctrine\Common\Persistence\ObjectManager; | |
use Doctrine\ORM\Tools\SchemaTool; | |
use RuntimeException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Bundle\SecurityBundle\Command\InitAclCommand; | |
use Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand; | |
use Doctrine\Bundle\DoctrineBundle\Command\Proxy\CreateSchemaDoctrineCommand; | |
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand; | |
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand; | |
require_once __DIR__.'/bootstrap.php.cache'; | |
require_once __DIR__.'/AppKernel.php'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backup / Export: | |
pg_dump -h localhost -p 5434 -U postgres_user -F c -b -v -f "/path/db.bak" db_name | |
Restore / Import: | |
pg_restore -h localhost -p 5434 -U postgres_user -d db_name -v "/path/db.bak" | |
-- Version: | |
select version() | |
-- ТОП20 наибольших таблиц |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Vagrant nginx & php-fpm | |
# Vagrant basic bootstrap.sh file configuration for getting a ready to use dev solution | |
# | |
# Ivan Zinovyev <vanyazin@gmail.com> | |
# | |
# (The "ubuntu/trusty64" box was used and tested) | |
# |