From fc6ed3c5fbe70b6481ffac79e2c17c2ee200dba0 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Tue, 9 Jun 2026 02:22:23 -0300 Subject: [PATCH] docs(STYLE.md): Require to list columns explicitly in `INSERT` statements --- STYLE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/STYLE.md b/STYLE.md index 98ff96e366..6b47eaa7c8 100644 --- a/STYLE.md +++ b/STYLE.md @@ -59,6 +59,13 @@ If column is already declared without `NOT NULL`, use `IFNULL` function to provi Use `HAVING COUNT(*) > 0` clause to [prevent aggregate functions such as `MIN` and `MAX` from returning `NULL`](https://stackoverflow.com/questions/66527856/aggregate-functions-max-etc-return-null-instead-of-no-rows). +List columns explicitly in `INSERT` statements: +``` +INSERT OR IGNORE INTO download (rfc724_mid, msg_id) VALUES (?,0); +``` +Otherwise if a new column with default value is added in a future DB version, an upgraded DB can't +be used with the old code, e.g. after transferring a DB from a device running a newer version. + Don't delete unused columns too early, but maybe after several months/releases, unused columns are still used by older versions, so deleting them breaks downgrading the core or importing a backup in an older version. Also don't change the column type, consider adding a new column with another name