[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][ftp-team/dak][master] 2 commits: Remove duplicate constraint



Title: GitLab

Ansgar Burchardt pushed to branch master at Debian FTP Team / dak

Commits:

1 changed file:

Changes:

  • dak/dakdb/update120.py
    1
    +#!/usr/bin/env python
    
    2
    +# coding=utf8
    
    3
    +
    
    4
    +"""remove duplicate constraint
    
    5
    +
    
    6
    +@contact: Debian FTP Master <ftpmaster@debian.org>
    
    7
    +@copyright: 2018, Bastian Blank <waldi@debian.org>
    
    8
    +@license: GNU General Public License version 2 or later
    
    9
    +"""
    
    10
    +
    
    11
    +# This program is free software; you can redistribute it and/or modify
    
    12
    +# it under the terms of the GNU General Public License as published by
    
    13
    +# the Free Software Foundation; either version 2 of the License, or
    
    14
    +# (at your option) any later version.
    
    15
    +
    
    16
    +# This program is distributed in the hope that it will be useful,
    
    17
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    18
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    19
    +# GNU General Public License for more details.
    
    20
    +
    
    21
    +# You should have received a copy of the GNU General Public License
    
    22
    +# along with this program; if not, write to the Free Software
    
    23
    +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    
    24
    +
    
    25
    +################################################################################
    
    26
    +
    
    27
    +from __future__ import print_function
    
    28
    +
    
    29
    +import psycopg2
    
    30
    +from daklib.dak_exceptions import DBUpdateError
    
    31
    +from daklib.config import Config
    
    32
    +
    
    33
    +################################################################################
    
    34
    +
    
    35
    +
    
    36
    +def do_update(self):
    
    37
    +    print(__doc__)
    
    38
    +    try:
    
    39
    +        cnf = Config()
    
    40
    +
    
    41
    +        c = self.db.cursor()
    
    42
    +
    
    43
    +        c.execute("ALTER TABLE ONLY suite_src_formats DROP CONSTRAINT suite_src_formats_suite_key")
    
    44
    +
    
    45
    +        c.execute("UPDATE config SET value = '120' WHERE name = 'db_revision'")
    
    46
    +        self.db.commit()
    
    47
    +
    
    48
    +    except psycopg2.ProgrammingError as msg:
    
    49
    +        self.db.rollback()
    
    50
    +        raise DBUpdateError('Unable to apply sick update 120, rollback issued. Error message: {0}'.format(msg))


  • Reply to: