openai_seo_schema incorrect type

Created on 1 December 2023, about 1 year ago
Updated 5 December 2023, about 1 year ago

Problem/Motivation

During a database import I noticed this.

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL DEFAULT NULL DEFAULT NULL COMMENT
'Report entity: Entity type id',
"entity' at line 3: CREATE TABLE "openai_seo" (
"rid" INT NOT NULL auto_increment COMMENT 'Primary Key: Unique report ID',
"entity_type_id" NULL DEFAULT NULL DEFAULT NULL COMMENT 'Report entity: Entity type id',
"entity_id" INT NULL DEFAULT NULL DEFAULT NULL COMMENT 'Report entity: Matching "entity".id',
"revision_id" INT NULL DEFAULT NULL DEFAULT NULL COMMENT 'Report node: Matching "node" revision.id',
"url" VARCHAR(500) NULL DEFAULT NULL DEFAULT NULL COMMENT 'Report URL: The URL the report was generated from',
"uid" INT NOT NULL COMMENT 'Report author: Matching "user".id',
"report" LONGTEXT NULL DEFAULT NULL COMMENT 'Full text of the SEO report',
"prompt" LONGTEXT NULL DEFAULT NULL COMMENT 'Prompt used to generate this report',
"seed" INT NULL DEFAULT NULL DEFAULT NULL COMMENT 'Seed used to generate the response',
"timestamp" INT NOT NULL DEFAULT 0 COMMENT 'Timestamp of the report creation',
PRIMARY KEY ("rid"),
INDEX "entity_id" ("entity_id"),
INDEX "uid" ("uid")
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Stores all SEO reports.'; Array
(
)

Steps to reproduce

I think just installing via command line will show this error.

Proposed resolution

The openai_seo_schema() function. The 'type' for 'entity_type_id' is set as 'string', but in MySQL there's no 'string' type. You should use 'varchar' instead. Also, the 'default' key is set to NULL, which is not necessary for 'varchar' type.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States NicholasS

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024