db.changelog.20200522-standardize-timestamps.yml Maven / Gradle / Ivy
databaseChangeLog:
- changeSet:
id: standardize-timestamps-agent_lock
author: fletch
changes:
- renameColumn:
tableName: agent_lock
oldColumnName: expiry
newColumnName: expiry_old
columnDataType: bigint(13)
- addColumn:
tableName: agent_lock
columns:
- column:
name: expiry
type: timestamp(3)
constraints:
- nullable: false
- sql:
sql: |
update agent_lock set expiry = from_unixtime(expiry_old / 1000);
- dropColumn:
tableName: agent_lock
columnName: expiry_old
- changeSet:
id: standardize-timestamps-diff_fingerprint
author: fletch
changes:
- renameColumn:
tableName: diff_fingerprint
oldColumnName: first_detection_time
newColumnName: first_detection_time_old
columnDataType: bigint(13)
- addColumn:
tableName: diff_fingerprint
columns:
- column:
name: first_detection_time
type: timestamp(3)
constraints:
- nullable: false
- sql:
sql: |
update diff_fingerprint set first_detection_time = from_unixtime(first_detection_time_old / 1000);
- dropColumn:
tableName: diff_fingerprint
columnName: first_detection_time_old
- changeSet:
id: standardize-timestamps-environment_artifact_pin
author: fletch
changes:
- renameColumn:
tableName: environment_artifact_pin
oldColumnName: pinned_at
newColumnName: pinned_at_old
columnDataType: bigint(13)
- addColumn:
tableName: environment_artifact_pin
columns:
- column:
name: pinned_at
type: timestamp(3)
constraints:
- nullable: false
- sql:
sql: |
update environment_artifact_pin set pinned_at = from_unixtime(pinned_at_old / 1000);
- dropColumn:
tableName: environment_artifact_pin
columnName: pinned_at_old
- changeSet:
id: standardize-timestamps-environment_artifact_queued_approval
author: fletch
changes:
- renameColumn:
tableName: environment_artifact_queued_approval
oldColumnName: queued_at
newColumnName: queued_at_old
columnDataType: bigint(13)
- addColumn:
tableName: environment_artifact_queued_approval
columns:
- column:
name: queued_at
type: timestamp(3)
constraints:
- nullable: false
- sql:
sql: |
update environment_artifact_queued_approval set queued_at = from_unixtime(queued_at_old / 1000);
- dropColumn:
tableName: environment_artifact_queued_approval
columnName: queued_at_old
- changeSet:
id: standardize-timestamps-task_tracking
author: fletch
changes:
- renameColumn:
tableName: task_tracking
oldColumnName: timestamp
newColumnName: timestamp_old
columnDataType: bigint(13)
- addColumn:
tableName: task_tracking
columns:
- column:
name: timestamp
type: timestamp(3)
constraints:
- nullable: false
- sql:
sql: |
update task_tracking set timestamp = from_unixtime(timestamp_old / 1000);
- dropColumn:
tableName: task_tracking
columnName: timestamp_old
- changeSet:
id: standardize-timestamps-unhappy_veto
author: fletch
changes:
- renameColumn:
tableName: unhappy_veto
oldColumnName: recheck_time
newColumnName: recheck_time_old
columnDataType: bigint(13)
- dropNotNullConstraint:
tableName: unhappy_veto
columnName: recheck_time_old
columnDataType: bigint(13)
- sql:
sql: |
update unhappy_veto set recheck_time_old = null where recheck_time_old = 9223372036854775807;
- addColumn:
tableName: unhappy_veto
columns:
- column:
name: recheck_time
type: timestamp(3)
constraints:
- nullable: true
- sql:
sql: |
update unhappy_veto set recheck_time = from_unixtime(recheck_time_old / 1000) where recheck_time_old is not null;
- dropColumn:
tableName: unhappy_veto
columnName: recheck_time_old
- changeSet:
id: standardize-timestamps-add-subsecond-precision
author: fletch
changes:
- sql:
sql: |
alter table artifact_last_checked modify at timestamp(3) not null;
alter table delivery_config_last_checked modify at timestamp(3) not null;
alter table environment_artifact_constraint modify created_at timestamp(3) not null;
alter table environment_artifact_constraint modify judged_at timestamp(3) null;
alter table environment_artifact_versions modify approved_at timestamp(3) null;
alter table environment_artifact_versions modify deployed_at timestamp(3) null;
alter table environment_artifact_versions modify replaced_at timestamp(3) null;
alter table event modify timestamp timestamp(3) not null;
alter table paused modify paused_at timestamp(3) null;
alter table resource_last_checked modify at timestamp(3) not null;