Skip to content

The query with CHECK constraint fails #251

@wojtekn

Description

@wojtekn

A user reported that the site import was failing in Studio. The root cause is the CREATE TABLE query that includes a CHECK constraint.

Steps to reproduce

  1. Create a Studio site
  2. Navigate to Import / Export tab
  3. Import the SQL file that includes the query shown below

Expectation

I expect the query to be executed successfully.

Instead, it fails with an error.

CREATE TABLE `my_table` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `url` longtext NOT NULL,
  `archived` longtext DEFAULT NULL,
  `is_broken` tinyint(1) NOT NULL DEFAULT 0,
  `checks` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`checks`)),
  `message` longtext DEFAULT NULL,
  `redirect_url` longtext DEFAULT NULL,
  `excluded` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=300 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions