li7y/migrations/20240711190709_add_creation_timestamp.up.sql

22 lines
470 B
MySQL
Raw Normal View History

-- SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
ALTER TABLE items
ADD created_at TIMESTAMP WITH TIME ZONE DEFAULT now();
UPDATE items
SET created_at = now();
ALTER TABLE items
ALTER created_at SET NOT NULL;
ALTER TABLE item_classes
ADD created_at TIMESTAMP WITH TIME ZONE DEFAULT now();
UPDATE item_classes
SET created_at = now();
ALTER TABLE item_classes
ALTER created_at SET NOT NULL;