I have a schema migration plan to add json column to mariadb 10.2. But I am required to have a reverse plan. Here's the forward plan:
ALTER TABLE `mydb`.`table1`
ADD COLUMN jsonf JSON DEFAULT NULL;
ALTER TABLE `mydb`.`table1`
ADD CHECK(JSON_VALID(jsonf)) ;
Here's the reverse/rollback plan:
ALTER TABLE `mydb`.`table1`
DROP COLUMN jsonf;
DROP CHECK ?
What I am confused is how do I reverse the CHECK? Thank you.
UPDATE:
I got error
Kernel error: Error( 4025 ) 23000: "CONSTRAINT `jsonf_is_json` failed for `mydb`.`#sql-8f8_d0c5c1`"
when I try to run add constraint:
ALTER TABLE `mydb`.`table1`
ADD CONSTRAINT jsonf_is_json CHECK(JSON_VALID(jsonf));
I use mariadb 10.2.8 if that matters