-
-
Save goellner/674d9bc91f4e95c0560c5db683caae0e to your computer and use it in GitHub Desktop.
JSON validation for laravel-translatable column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE user | |
ADD CONSTRAINT attributes_are_valid check( | |
JSON_SCHEMA_VALID('{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"type": "object", | |
"patternProperties" : { | |
"^[a-z][a-z]$": { | |
"type": "string" | |
} | |
}, | |
"minProperties": 1, | |
"additionalProperties": false | |
}', slug | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment