<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Location-permission telemetry table: lets us measure server-side how many users have
* Location Services / location permission enabled, independent of whether a GPS fix ever lands.
*/
final class Version20260605120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add user_location_permission table for location-permission telemetry';
}
public function up(Schema $schema): void
{
$this->addSql(
'CREATE TABLE user_location_permission (
id BIGINT UNSIGNED NOT NULL,
permission VARCHAR(32) DEFAULT NULL,
services_enabled TINYINT(1) DEFAULT NULL,
reported_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\',
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB'
);
$this->addSql(
'ALTER TABLE user_location_permission ADD CONSTRAINT FK_user_location_permission_user FOREIGN KEY (id) REFERENCES user (id) ON DELETE CASCADE'
);
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE user_location_permission DROP FOREIGN KEY FK_user_location_permission_user');
$this->addSql('DROP TABLE user_location_permission');
}
}