Mercurial > kallithea
annotate rhodecode/lib/dbmigrate/versions/014_version_1_7_1.py @ 4099:43b54436d459
update issue tracker and official site
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 01 Sep 2013 19:56:08 +0200 |
parents | 3cb5a35a319d |
children | ffd45b185016 |
rev | line source |
---|---|
3972
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 import logging |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 import datetime |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 from sqlalchemy import * |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 from sqlalchemy.exc import DatabaseError |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 from sqlalchemy.orm import relation, backref, class_mapper, joinedload |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 from sqlalchemy.orm.session import Session |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 from sqlalchemy.ext.declarative import declarative_base |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 from rhodecode.lib.dbmigrate.migrate import * |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 from rhodecode.lib.dbmigrate.migrate.changeset import * |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
13 from rhodecode.model.meta import Base |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 from rhodecode.model import meta |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
15 from rhodecode.lib.dbmigrate.versions import _reset_base |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 log = logging.getLogger(__name__) |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
18 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
19 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
20 def upgrade(migrate_engine): |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
21 """ |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
22 Upgrade operations go here. |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 Don't create your own engine; bind migrate_engine to your metadata |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 """ |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
25 _reset_base(migrate_engine) |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 #========================================================================== |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 # Gist |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 #========================================================================== |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 from rhodecode.lib.dbmigrate.schema.db_1_7_0 import Gist |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
31 tbl = Gist.__table__ |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 user_id = tbl.columns.gist_expires |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 user_id.alter(type=Float(53)) |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
34 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 def downgrade(migrate_engine): |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
37 meta = MetaData() |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 meta.bind = migrate_engine |