Issue #134: updated_on column of repositories table required (conservancy/kallithea)
Michael JasonSmith
issues-reply at bitbucket.org
Thu May 21 13:11:19 EDT 2015
New issue 134: updated_on column of repositories table required
https://bitbucket.org/conservancy/kallithea/issue/134/updated_on-column-of-repositories-table
Michael JasonSmith:
## Currently ##
The *updated_on* column of the *repositories* table is unconstrained. However, if a row has a *updated_on* set to NULL then the repositories page fails to render.
## Expected ##
Either
* The *updated_on* column of the *repositories* table should have a *not null* constraint, or
* Pages that rely on the column should be able to cope with null values.
## Traceback ##
Full traceback in kallithea-last_change-traceback.txt attacked to this issue.
```
#!pytb
File '...kallithea/data/templates/data_table/_dt_elements.html.py', line 400 in render_last_change
__M_writer(escape(h.age(last_change)))
File '...kallithea/local/lib/python2.7/site-packages/kallithea/lib/helpers.py', line 428 in <lambda>
age = lambda x, y=False: _age(x, y)
File '...kallithea/local/lib/python2.7/site-packages/kallithea/lib/utils2.py', line 374 in age
if prevdate > now:
TypeError: can't compare datetime.datetime to NoneType
```
## Admission ##
I was migrating an old RhodeCode system to Kallithea, so admittedly my data is a little odd, which is why I ran into this issue. However, a vanilla Kallithea 0.2.1 install has the identical problematic schema for the *repositories* table:
```
#!
created_on | timestamp without time zone |
updated_on | timestamp without time zone |
```
My hack around the issue was to add *updated_on* data:
```
#!sql
update repositories
set updated_on = created_on
where updated_on is null;
```
More information about the kallithea-general
mailing list