Mercurial > kallithea
annotate rhodecode/lib/dbmigrate/versions/014_version_1_7_1.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:03:13 -0400 |
parents | 3cb5a35a319d |
children | 7e5f8c12a3fc |
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) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
26 from rhodecode.lib.dbmigrate.schema import db_1_7_0 |
3972
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 #========================================================================== |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 # Gist |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 #========================================================================== |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
31 tbl = db_1_7_0.Gist.__table__ |
3972
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 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
35 # issue fixups |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
36 fixups(db_1_7_0, meta.Session) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
37 |
3972
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 def downgrade(migrate_engine): |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
40 meta = MetaData() |
3cb5a35a319d
added migrations for column change for gists expiration date
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 meta.bind = migrate_engine |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
42 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
43 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
44 def fixups(models, _SESSION): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
45 # fix nullable columns on last_update |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
46 for r in models.Repository().get_all(): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
47 if r.updated_on is None: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
48 r.updated_on = datetime.datetime.fromtimestamp(0) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
49 _SESSION().add(r) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3972
diff
changeset
|
50 _SESSION().commit() |