Show More
@@ -0,0 +1,51 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 | |||
|
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 |
@@ -38,7 +38,7 b' except ImportError:' | |||||
38 |
|
38 | |||
39 | __version__ = ('.'.join((str(each) for each in VERSION[:3])) + |
|
39 | __version__ = ('.'.join((str(each) for each in VERSION[:3])) + | |
40 | '.'.join(VERSION[3:])) |
|
40 | '.'.join(VERSION[3:])) | |
41 |
__dbversion__ = |
|
41 | __dbversion__ = 7 # defines current db version for migrations | |
42 | __platform__ = platform.system() |
|
42 | __platform__ = platform.system() | |
43 | __license__ = 'GPLv3' |
|
43 | __license__ = 'GPLv3' | |
44 | __py_version__ = sys.version_info |
|
44 | __py_version__ = sys.version_info |
@@ -254,6 +254,9 b' class DbManage(object):' | |||||
254 | reg_perm.permission = perm |
|
254 | reg_perm.permission = perm | |
255 | Session().add(reg_perm) |
|
255 | Session().add(reg_perm) | |
256 |
|
256 | |||
|
257 | def step_7(self): | |||
|
258 | pass | |||
|
259 | ||||
257 | upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1) |
|
260 | upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1) | |
258 |
|
261 | |||
259 | # CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE |
|
262 | # CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE |
@@ -602,6 +602,7 b' class Repository(Base, BaseModel):' | |||||
602 | enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True) |
|
602 | enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True) | |
603 | description = Column("description", String(10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
603 | description = Column("description", String(10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
604 | created_on = Column('created_on', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now) |
|
604 | created_on = Column('created_on', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now) | |
|
605 | updated_on = Column('updated_on', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now) | |||
605 | landing_rev = Column("landing_revision", String(255, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default=None) |
|
606 | landing_rev = Column("landing_revision", String(255, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default=None) | |
606 | enable_locking = Column("enable_locking", Boolean(), nullable=False, unique=None, default=False) |
|
607 | enable_locking = Column("enable_locking", Boolean(), nullable=False, unique=None, default=False) | |
607 | _locked = Column("locked", String(255, convert_unicode=False, assert_unicode=None), nullable=True, unique=False, default=None) |
|
608 | _locked = Column("locked", String(255, convert_unicode=False, assert_unicode=None), nullable=True, unique=False, default=None) |
General Comments 0
You need to be logged in to leave comments.
Login now