Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-backend / pithos / backends / lib / sqlalchemy / alembic / versions / 2a309a9a3438_fix_statistics_negat.py @ 29148653

History | View | Annotate | Download (558 Bytes)

1
"""fix statistics negative population
2

3
Revision ID: 2a309a9a3438
4
Revises: 165ba3fbfe53
5
Create Date: 2013-01-02 09:12:30.222261
6

7
"""
8

    
9
# revision identifiers, used by Alembic.
10
revision = '2a309a9a3438'
11
down_revision = '165ba3fbfe53'
12

    
13
from alembic import op
14
import sqlalchemy as sa
15

    
16

    
17
def upgrade():
18
    st = sa.sql.table(
19
        'statistics',
20
        sa.sql.column('node', sa.Integer),
21
        sa.sql.column('population', sa.Integer)
22
    )
23

    
24
    u = st.update().where(st.c.population < 0).values({'population': 0})
25
    op.execute(u)
26

    
27

    
28
def downgrade():
29
    pass