Show More
@@ -0,0 +1,38 b'' | |||
|
1 | import logging | |
|
2 | import datetime | |
|
3 | ||
|
4 | from sqlalchemy import * | |
|
5 | from sqlalchemy.exc import DatabaseError | |
|
6 | from sqlalchemy.orm import relation, backref, class_mapper, joinedload | |
|
7 | from sqlalchemy.orm.session import Session | |
|
8 | from sqlalchemy.ext.declarative import declarative_base | |
|
9 | ||
|
10 | from rhodecode.lib.dbmigrate.migrate import * | |
|
11 | from rhodecode.lib.dbmigrate.migrate.changeset import * | |
|
12 | ||
|
13 | from rhodecode.model.meta import Base | |
|
14 | from rhodecode.model import meta | |
|
15 | from rhodecode.lib.dbmigrate.versions import _reset_base | |
|
16 | ||
|
17 | log = logging.getLogger(__name__) | |
|
18 | ||
|
19 | ||
|
20 | def upgrade(migrate_engine): | |
|
21 | """ | |
|
22 | Upgrade operations go here. | |
|
23 | Don't create your own engine; bind migrate_engine to your metadata | |
|
24 | """ | |
|
25 | _reset_base(migrate_engine) | |
|
26 | ||
|
27 | #========================================================================== | |
|
28 | # Gist | |
|
29 | #========================================================================== | |
|
30 | from rhodecode.lib.dbmigrate.schema.db_1_7_0 import Gist | |
|
31 | tbl = Gist.__table__ | |
|
32 | user_id = tbl.columns.gist_expires | |
|
33 | user_id.alter(type=Float(53)) | |
|
34 | ||
|
35 | ||
|
36 | def downgrade(migrate_engine): | |
|
37 | meta = MetaData() | |
|
38 | meta.bind = migrate_engine |
@@ -51,7 +51,7 b' except ImportError:' | |||
|
51 | 51 | |
|
52 | 52 | __version__ = ('.'.join((str(each) for each in VERSION[:3])) + |
|
53 | 53 | '.'.join(VERSION[3:])) |
|
54 |
__dbversion__ = 1 |
|
|
54 | __dbversion__ = 14 # defines current db version for migrations | |
|
55 | 55 | __platform__ = platform.system() |
|
56 | 56 | __license__ = 'GPLv3' |
|
57 | 57 | __py_version__ = sys.version_info |
@@ -30,6 +30,7 b' import time' | |||
|
30 | 30 | import uuid |
|
31 | 31 | import logging |
|
32 | 32 | from os.path import dirname as dn, join as jn |
|
33 | import datetime | |
|
33 | 34 | |
|
34 | 35 | from rhodecode import __dbversion__, __py_version__ |
|
35 | 36 | |
@@ -216,6 +217,13 b' class UpgradeSteps(object):' | |||
|
216 | 217 | def step_13(self): |
|
217 | 218 | pass |
|
218 | 219 | |
|
220 | def step_14(self): | |
|
221 | # fix nullable columns on last_update | |
|
222 | for r in RepoModel().get_all(): | |
|
223 | if r.updated_on is None: | |
|
224 | r.updated_on = datetime.datetime.fromtimestamp(0) | |
|
225 | Session().add(r) | |
|
226 | Session().commit() | |
|
219 | 227 | |
|
220 | 228 | class DbManage(object): |
|
221 | 229 | def __init__(self, log_sql, dbconf, root, tests=False, cli_args={}): |
General Comments 0
You need to be logged in to leave comments.
Login now