Make sure to not migrate 0 unix timestamps to 1970 iso dates
continuous-integration/drone/pr Build was killed
Details
continuous-integration/drone/pr Build was killed
Details
This commit is contained in:
parent
e3e27ab94b
commit
0bbe6b93b5
|
@ -65,7 +65,7 @@ create table files_dg_tmp
|
|||
name TEXT not null,
|
||||
mime TEXT,
|
||||
size INTEGER not null,
|
||||
created datetime,
|
||||
created datetime not null,
|
||||
created_by_id INTEGER not null
|
||||
);
|
||||
|
||||
|
@ -270,7 +270,7 @@ create table task_attachments_dg_tmp
|
|||
task_id INTEGER not null,
|
||||
file_id INTEGER not null,
|
||||
created_by_id INTEGER not null,
|
||||
created datetime
|
||||
created datetime not null
|
||||
);
|
||||
|
||||
insert into task_attachments_dg_tmp(id, task_id, file_id, created_by_id, created) select id, task_id, file_id, created_by_id, created from task_attachments;
|
||||
|
@ -290,8 +290,8 @@ create table task_comments_dg_tmp
|
|||
comment TEXT not null,
|
||||
author_id INTEGER not null,
|
||||
task_id INTEGER not null,
|
||||
created datetime,
|
||||
updated datetime
|
||||
created datetime not null,
|
||||
updated datetime not null
|
||||
);
|
||||
|
||||
insert into task_comments_dg_tmp(id, comment, author_id, task_id, created, updated) select id, comment, author_id, task_id, created, updated from task_comments;
|
||||
|
@ -500,8 +500,8 @@ create table teams_dg_tmp
|
|||
name TEXT not null,
|
||||
description TEXT,
|
||||
created_by_id INTEGER not null,
|
||||
created datetime,
|
||||
updated datetime
|
||||
created datetime not null,
|
||||
updated datetime not null
|
||||
);
|
||||
|
||||
insert into teams_dg_tmp(id, name, description, created_by_id, created, updated) select id, name, description, created_by_id, created, updated from teams;
|
||||
|
@ -656,10 +656,16 @@ create unique index UQE_users_namespace_id
|
|||
}
|
||||
case schemas.SQLITE:
|
||||
// welp
|
||||
// sqlite will need a long string with all table modifications
|
||||
// But at least we can do the conversion of data with it
|
||||
sql = []string{
|
||||
"UPDATE " + table + " SET " + colFinal + " = DATETIME(" + colFinal + ", 'unixepoch', 'localtime')",
|
||||
// All created and updated columns are set to not null
|
||||
// But some of the test data is 0 so we can't use our update script on it.
|
||||
if column != "updated" && column != "created" {
|
||||
sql = []string{
|
||||
"UPDATE " + table + " SET " + colFinal + " = CASE WHEN " + colFinal + " > 0 THEN DATETIME(" + colFinal + ", 'unixepoch', 'localtime') ELSE NULL END",
|
||||
}
|
||||
} else {
|
||||
sql = []string{
|
||||
"UPDATE " + table + " SET " + colFinal + " = DATETIME(" + colFinal + ", 'unixepoch', 'localtime')",
|
||||
}
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("unsupported dbms: %s", tx.Dialect().URI().DBType)
|
||||
|
|
Loading…
Reference in New Issue