migrations/Version20260605120000.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Location-permission telemetry table: lets us measure server-side how many users have
  8.  * Location Services / location permission enabled, independent of whether a GPS fix ever lands.
  9.  */
  10. final class Version20260605120000 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return 'Add user_location_permission table for location-permission telemetry';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         $this->addSql(
  19.             'CREATE TABLE user_location_permission (
  20.                 id BIGINT UNSIGNED NOT NULL,
  21.                 permission VARCHAR(32) DEFAULT NULL,
  22.                 services_enabled TINYINT(1) DEFAULT NULL,
  23.                 reported_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\',
  24.                 PRIMARY KEY(id)
  25.             ) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB'
  26.         );
  27.         $this->addSql(
  28.             'ALTER TABLE user_location_permission ADD CONSTRAINT FK_user_location_permission_user FOREIGN KEY (id) REFERENCES user (id) ON DELETE CASCADE'
  29.         );
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         $this->addSql('ALTER TABLE user_location_permission DROP FOREIGN KEY FK_user_location_permission_user');
  34.         $this->addSql('DROP TABLE user_location_permission');
  35.     }
  36. }