Mercurial > kallithea
comparison rhodecode/lib/dbmigrate/versions/007_version_1_4_0.py @ 2797:c9baaacb670a beta
Remove null from revision column as for comments inside pull requests to work properly
new migration adds column for future simpler main page
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 04 Sep 2012 01:07:34 +0200 |
parents | |
children | 7e5f8c12a3fc |
comparison
equal
deleted
inserted
replaced
2796:bf3c976d02ec | 2797:c9baaacb670a |
---|---|
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 | |
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 | |
16 log = logging.getLogger(__name__) | |
17 | |
18 | |
19 def upgrade(migrate_engine): | |
20 """ | |
21 Upgrade operations go here. | |
22 Don't create your own engine; bind migrate_engine to your metadata | |
23 """ | |
24 | |
25 #========================================================================== | |
26 # CHANGESET_COMMENTS | |
27 #========================================================================== | |
28 from rhodecode.lib.dbmigrate.schema.db_1_4_0 import ChangesetComment | |
29 tbl_name = ChangesetComment.__tablename__ | |
30 tbl = Table(tbl_name, | |
31 MetaData(bind=migrate_engine), autoload=True, | |
32 autoload_with=migrate_engine) | |
33 col = tbl.columns.revision | |
34 | |
35 # remove nullability from revision field | |
36 col.alter(nullable=True) | |
37 | |
38 #========================================================================== | |
39 # REPOSITORY | |
40 #========================================================================== | |
41 from rhodecode.lib.dbmigrate.schema.db_1_4_0 import Repository | |
42 tbl = Repository.__table__ | |
43 updated_on = Column('updated_on', DateTime(timezone=False), | |
44 nullable=True, unique=None) | |
45 # create created on column for future lightweight main page | |
46 updated_on.create(table=tbl) | |
47 | |
48 | |
49 def downgrade(migrate_engine): | |
50 meta = MetaData() | |
51 meta.bind = migrate_engine |