convert datetime fields to timestamp fields since we want to store UTC timestamps (#1187)

This commit is contained in:
Athou
2024-01-13 14:20:46 +01:00
parent b0aa6ae524
commit c4fbf98200
3 changed files with 30 additions and 3 deletions

View File

@@ -12,8 +12,8 @@ services:
postgresql:
image: postgres
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: commafeed
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=commafeed
ports:
- 5432:5432

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="use-timestamps" author="athou">
<modifyDataType tableName="FEEDS" columnName="lastUpdated" newDataType="TIMESTAMP" />
<modifyDataType tableName="FEEDS" columnName="lastPublishedDate" newDataType="TIMESTAMP" />
<modifyDataType tableName="FEEDS" columnName="lastEntryDate" newDataType="TIMESTAMP" />
<modifyDataType tableName="FEEDS" columnName="disabledUntil" newDataType="TIMESTAMP" />
<modifyDataType tableName="FEEDENTRIES" columnName="inserted" newDataType="TIMESTAMP" />
<modifyDataType tableName="FEEDENTRIES" columnName="updated" newDataType="TIMESTAMP" />
<modifyDataType tableName="FEEDENTRYSTATUSES" columnName="entryInserted" newDataType="TIMESTAMP" />
<modifyDataType tableName="FEEDENTRYSTATUSES" columnName="entryUpdated" newDataType="TIMESTAMP" />
<modifyDataType tableName="USERS" columnName="lastLogin" newDataType="TIMESTAMP" />
<modifyDataType tableName="USERS" columnName="created" newDataType="TIMESTAMP" />
<modifyDataType tableName="USERS" columnName="recoverPasswordTokenDate" newDataType="TIMESTAMP" />
<modifySql dbms="postgresql">
<!-- liquibase uses the 'TIMESTAMP WITHOUT TIME ZONE' type by default, which is not a UTC timestamp -->
<!-- postgresql UTC timestamp is actually 'TIMESTAMP WITH TIME ZONE' -->
<!-- see https://stackoverflow.com/a/48069726/1885506 -->
<replace replace="WITHOUT TIME ZONE" with="WITH TIME ZONE" />
</modifySql>
</changeSet>
</databaseChangeLog>

View File

@@ -24,5 +24,6 @@
<include file="changelogs/db.changelog-3.9.xml" />
<include file="changelogs/db.changelog-4.0.xml" />
<include file="changelogs/db.changelog-4.1.xml" />
<include file="changelogs/db.changelog-4.2.xml" />
</databaseChangeLog>