Skip to content

Instantly share code, notes, and snippets.

@7audio
7audio / watch-mysql-diff.php
Created September 14, 2018 16:24
makes mysqldump every N seconds, shows colordiff of two latest dumps
<?php
/*
makes mysqldump every N seconds, shows colordiff of two latest dumps.
useful for debugging: you see all changes made in database tables in last N seconds.
removes metadata from table so that only contents are diff'ed
requires mysqldump, colordiff
usage:
@7audio
7audio / DbImporterController.php
Created September 14, 2018 16:26
Yii2 console command that logs into remote server (presumably production), makes SQL dump, downloads it and import to local DB
<?php
/**
* Yii2 console command that logs into remote server (presumably production), makes SQL dump, downloads it and import to local DB
*/
namespace app\commands;
use yii\console\Controller;
use yii\helpers\Console;
<?php
/*
Структура таблицы для сохранения дерева:
CREATE TABLE `tree` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`title` varchar(512) NOT NULL,
`position` varchar(32) NOT NULL,
`value` int NOT NULL,
`currency` varchar(8) NOT NULL,