Skip to content

Fix SQLite migration: add default values for votes and hotness columns#143

Open
datlechin wants to merge 1 commit intoFriendsOfFlarum:2.xfrom
datlechin:fix/sqlite-migration-default-values
Open

Fix SQLite migration: add default values for votes and hotness columns#143
datlechin wants to merge 1 commit intoFriendsOfFlarum:2.xfrom
datlechin:fix/sqlite-migration-default-values

Conversation

@datlechin
Copy link
Copy Markdown
Contributor

Summary

SQLite cannot add NOT NULL columns without default values to existing tables. The migration 2019_07_09_000002_add_votes_and_hotness_to_discussions fails with:

Cannot add a NOT NULL column with default value NULL

This adds ->default(0) to both votes and hotness columns, which is the logical default anyway (new discussions start with 0 votes and 0 hotness).

SQLite cannot add NOT NULL columns without default values to existing
tables. Add default(0) to votes and hotness columns.
@datlechin datlechin requested a review from a team as a code owner February 24, 2026 10:25
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