Show More
@@ -1,63 +1,64 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2010-2019 RhodeCode GmbH |
|
3 | # Copyright (C) 2010-2019 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import logging |
|
21 | import logging | |
22 |
|
22 | |||
23 | from rhodecode.lib.paster_commands import BasePasterCommand, Command |
|
23 | from rhodecode.lib.paster_commands import BasePasterCommand, Command | |
24 |
|
24 | |||
25 | log = logging.getLogger(__name__) |
|
25 | log = logging.getLogger(__name__) | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | class UpgradeDb(BasePasterCommand): |
|
28 | class UpgradeDb(BasePasterCommand): | |
29 | """Command used for paster to upgrade our database to newer version |
|
29 | """ | |
|
30 | Command used for paster to upgrade our database to newer version | |||
30 | """ |
|
31 | """ | |
31 |
|
32 | |||
32 | max_args = 1 |
|
33 | max_args = 1 | |
33 | min_args = 1 |
|
34 | min_args = 1 | |
34 |
|
35 | |||
35 | usage = "CONFIG_FILE" |
|
36 | usage = "CONFIG_FILE" | |
36 | summary = "Upgrades current db to newer version" |
|
37 | summary = "Upgrades current db to newer version" | |
37 | group_name = "RhodeCode" |
|
38 | group_name = "RhodeCode" | |
38 |
|
39 | |||
39 | parser = Command.standard_parser(verbose=True) |
|
40 | parser = Command.standard_parser(verbose=True) | |
40 |
|
41 | |||
41 | def command(self): |
|
42 | def command(self): | |
42 | from rhodecode.lib.rc_commands import upgrade_db |
|
43 | from rhodecode.lib.rc_commands import upgrade_db | |
43 | upgrade_db.command( |
|
44 | upgrade_db.command( | |
44 | self.path_to_ini_file, self.options.__dict__.get('force_ask')) |
|
45 | self.path_to_ini_file, self.options.__dict__.get('force_ask'), None) | |
45 |
|
46 | |||
46 | def update_parser(self): |
|
47 | def update_parser(self): | |
47 | self.parser.add_option('--sql', |
|
48 | self.parser.add_option('--sql', | |
48 | action='store_true', |
|
49 | action='store_true', | |
49 | dest='just_sql', |
|
50 | dest='just_sql', | |
50 | help="Prints upgrade sql for further investigation", |
|
51 | help="Prints upgrade sql for further investigation", | |
51 | default=False) |
|
52 | default=False) | |
52 |
|
53 | |||
53 | self.parser.add_option('--force-yes', |
|
54 | self.parser.add_option('--force-yes', | |
54 | action='store_true', |
|
55 | action='store_true', | |
55 | dest='force_ask', |
|
56 | dest='force_ask', | |
56 | default=None, |
|
57 | default=None, | |
57 | help='Force yes to every question') |
|
58 | help='Force yes to every question') | |
58 | self.parser.add_option('--force-no', |
|
59 | self.parser.add_option('--force-no', | |
59 | action='store_false', |
|
60 | action='store_false', | |
60 | dest='force_ask', |
|
61 | dest='force_ask', | |
61 | default=None, |
|
62 | default=None, | |
62 | help='Force no to every question') |
|
63 | help='Force no to every question') | |
63 |
|
64 |
General Comments 0
You need to be logged in to leave comments.
Login now