Show More
@@ -1,35 +1,36 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | import logging |
|
3 | import logging | |
4 |
|
4 | |||
5 | from alembic.migration import MigrationContext |
|
5 | from alembic.migration import MigrationContext | |
6 | from alembic.operations import Operations |
|
6 | from alembic.operations import Operations | |
|
7 | from sqlalchemy import String | |||
7 |
|
8 | |||
8 | from rhodecode.lib.dbmigrate.versions import _reset_base |
|
9 | from rhodecode.lib.dbmigrate.versions import _reset_base | |
9 | from rhodecode.model import init_model_encryption |
|
10 | from rhodecode.model import init_model_encryption | |
10 |
|
11 | |||
11 |
|
12 | |||
12 | log = logging.getLogger(__name__) |
|
13 | log = logging.getLogger(__name__) | |
13 |
|
14 | |||
14 |
|
15 | |||
15 | def upgrade(migrate_engine): |
|
16 | def upgrade(migrate_engine): | |
16 | """ |
|
17 | """ | |
17 | Upgrade operations go here. |
|
18 | Upgrade operations go here. | |
18 | Don't create your own engine; bind migrate_engine to your metadata |
|
19 | Don't create your own engine; bind migrate_engine to your metadata | |
19 | """ |
|
20 | """ | |
20 | _reset_base(migrate_engine) |
|
21 | _reset_base(migrate_engine) | |
21 | from rhodecode.lib.dbmigrate.schema import db_4_16_0_2 |
|
22 | from rhodecode.lib.dbmigrate.schema import db_4_16_0_2 | |
22 |
|
23 | |||
23 | init_model_encryption(db_4_16_0_2) |
|
24 | init_model_encryption(db_4_16_0_2) | |
24 |
|
25 | |||
25 | context = MigrationContext.configure(migrate_engine.connect()) |
|
26 | context = MigrationContext.configure(migrate_engine.connect()) | |
26 | op = Operations(context) |
|
27 | op = Operations(context) | |
27 |
|
28 | |||
28 | repo_group = db_4_16_0_2.RepoGroup.__table__ |
|
29 | repo_group = db_4_16_0_2.RepoGroup.__table__ | |
29 |
|
30 | |||
30 | with op.batch_alter_table(repo_group.name) as batch_op: |
|
31 | with op.batch_alter_table(repo_group.name) as batch_op: | |
31 | batch_op.alter_column("repo_group_name_hash", nullable=False) |
|
32 | batch_op.alter_column("repo_group_name_hash", type_=String(1024), nullable=False) | |
32 |
|
33 | |||
33 |
|
34 | |||
34 | def downgrade(migrate_engine): |
|
35 | def downgrade(migrate_engine): | |
35 | pass |
|
36 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now