li7y/migrations/2024-07-09-133113_item_make_name_optional/up.sql
Simon Bruder c4a73204aa
Make item name optional
This vastly changes how item names are displayed. To make this more
ergonomic, it adds some helper macros. This also aids in adhering to
DRY.
2024-07-11 01:16:45 +02:00

14 lines
281 B
SQL

-- SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
ALTER TABLE items
ALTER name DROP NOT NULL;
UPDATE items
SET name = NULL
WHERE name = '';
ALTER TABLE items
ADD CONSTRAINT name_not_empty CHECK(name <> '');