deleted weedkeeper migrations
This commit is contained in:
parent
56fa3c512e
commit
7a96e5175d
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241130201314 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'rename status and thermometer to reference location';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("RENAME TABLE `thermometer` TO `location_thermometer`");
|
||||
$this->addSql("RENAME TABLE `status` TO `location_status`");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("RENAME TABLE `location_thermometer` TO `thermometer`");
|
||||
$this->addSql("RENAME TABLE `location_status` TO `status`");
|
||||
}
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241130202949 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'update procedure to last migration';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DROP PROCEDURE pS_LOCATION_ThermometerHistoryGraphList");
|
||||
$this->addSql("
|
||||
CREATE PROCEDURE pS_LOCATION_ThermometerHistoryGraphList (
|
||||
IN locaiton_id BINARY(16),
|
||||
IN start_at DATETIME,
|
||||
IN end_at DATETIME,
|
||||
IN `interval` int
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(created_at) / (`interval` * 60)) * (`interval` * 60)) AS time_interval,
|
||||
ROUND(AVG(temperature),1) AS avg_temperature,
|
||||
ROUND(AVG(humidity)) AS avg_humidity
|
||||
FROM
|
||||
location_thermometer
|
||||
WHERE
|
||||
locaiton_id = locaiton_id AND
|
||||
(created_at >= COALESCE(start_at, '1970-01-01 00:00:00')) AND
|
||||
(created_at <= COALESCE(end_at, NOW()))
|
||||
GROUP BY
|
||||
time_interval
|
||||
ORDER BY
|
||||
time_interval ASC;
|
||||
END;
|
||||
");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DROP PROCEDURE pS_LOCATION_ThermometerHistoryGraphList");
|
||||
$this->addSql("
|
||||
CREATE PROCEDURE pS_LOCATION_ThermometerHistoryGraphList (
|
||||
IN locaiton_id BINARY(16),
|
||||
IN start_at DATETIME,
|
||||
IN end_at DATETIME,
|
||||
IN `interval` int
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(created_at) / (`interval` * 60)) * (`interval` * 60)) AS time_interval,
|
||||
ROUND(AVG(temperature),1) AS avg_temperature,
|
||||
ROUND(AVG(humidity)) AS avg_humidity
|
||||
FROM
|
||||
thermometer
|
||||
WHERE
|
||||
locaiton_id = locaiton_id AND
|
||||
(created_at >= COALESCE(start_at, '1970-01-01 00:00:00')) AND
|
||||
(created_at <= COALESCE(end_at, NOW()))
|
||||
GROUP BY
|
||||
time_interval
|
||||
ORDER BY
|
||||
time_interval ASC;
|
||||
END;
|
||||
");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user