Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alt attribute should default to null in Media model #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

selfsimilar
Copy link
Contributor

The recently added alt column's default empty string value means that new records will always include the alt column as a value to insert (e.g.

INSERT INTO `media`
(`alt`, `disk`, `filename`, `extension`, `mime_type`, `updated_at`, `created_at`)
values
('', 'public', 'example', 'png', 'image/png', '2024-01-01 00:00:00',  '2024-01-01 00:00:00')

In addition to creating more verbose queries and slightly larger records on disk, this will break when using Spatie's Laravel Translatable package if, as is recommended, the column type is changed to JSON which still stores the value as LONGTEXT but adds a constraint of json_valid(alt) which will accept null but not an empty string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant