Skip to content

Commit

Permalink
Change entities deletedAt precision and add timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite committed May 15, 2024
1 parent b9c50ee commit fa058de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/model/frames/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Entity extends Frame.define(
'int4', 'int4',
'conflictType',
'timestamptz',
'timestamptz', 'timestamp',
'timestamptz', 'timestampz',
])
) {
get def() { return this.aux.def; }
Expand Down
18 changes: 18 additions & 0 deletions lib/model/migrations/20240515-01-entity-tz-precision.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2024 ODK Central Developers
// See the NOTICE file at the top-level directory of this distribution and at
// https://github.com/getodk/central-backend/blob/master/NOTICE.
// This file is part of ODK Central. It is subject to the license terms in
// the LICENSE file found in the top-level directory of this distribution and at
// https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central,
// including this file, may be copied, modified, propagated, or distributed
// except according to the terms contained in the LICENSE file.

const up = async (db) => {
await db.raw('ALTER TABLE entities ALTER COLUMN "deletedAt" TYPE timestamptz(3)');
};

const down = async (db) => {
await db.raw('ALTER TABLE entities ALTER COLUMN "deletedAt" TYPE timestamp(3)');
};

module.exports = { up, down };

0 comments on commit fa058de

Please sign in to comment.