Skip to content

Commit

Permalink
Replace sql type TEXT by LONGTEXT for profile field when using mysql …
Browse files Browse the repository at this point in the history
…driver
  • Loading branch information
maxime masson committed Dec 21, 2022
1 parent 597eecc commit 24ec45d
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/Db/PdoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,26 @@ public function getStatistics()

public function initSchema(): void
{
$profileColumnType = $this->driverName === 'mysql' ? 'LONGTEXT' : 'TEXT';
$this->pdo->exec(sprintf('
CREATE TABLE IF NOT EXISTS %s (
"id" CHAR(24) PRIMARY KEY,
"profile" TEXT NOT NULL,
"url" TEXT NULL,
"SERVER" TEXT NULL,
"GET" TEXT NULL,
"ENV" TEXT NULL,
"simple_url" TEXT NULL,
"request_ts" INTEGER NOT NULL,
"request_ts_micro" NUMERIC(15, 4) NOT NULL,
"request_date" DATE NOT NULL,
"main_wt" INTEGER NOT NULL,
"main_ct" INTEGER NOT NULL,
"main_cpu" INTEGER NOT NULL,
"main_mu" INTEGER NOT NULL,
"main_pmu" INTEGER NOT NULL
"id" CHAR(24) PRIMARY KEY,
"profile" %s NOT NULL,
"url" TEXT NULL,
"SERVER" TEXT NULL,
"GET" TEXT NULL,
"ENV" TEXT NULL,
"simple_url" TEXT NULL,
"request_ts" INTEGER NOT NULL,
"request_ts_micro" NUMERIC(15, 4) NOT NULL,
"request_date" DATE NOT NULL,
"main_wt" INTEGER NOT NULL,
"main_ct" INTEGER NOT NULL,
"main_cpu" INTEGER NOT NULL,
"main_mu" INTEGER NOT NULL,
"main_pmu" INTEGER NOT NULL
)
', $this->table));
', $this->table, $profileColumnType));
$this->pdo->exec(sprintf('
CREATE TABLE IF NOT EXISTS %s (
"id" CHAR(24) PRIMARY KEY,
Expand Down

0 comments on commit 24ec45d

Please sign in to comment.