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

[Git][ftp-team/dak][master] 2 commits: Remove unused database objects



Title: GitLab

Joerg Jaspert pushed to branch master at Debian FTP Team / dak

Commits:

2 changed files:

Changes:

  • dak/dakdb/update119.py
    1
    +#!/usr/bin/env python
    
    2
    +# coding=utf8
    
    3
    +
    
    4
    +"""remove unused database objects
    
    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
    +import psycopg2
    
    28
    +from daklib.dak_exceptions import DBUpdateError
    
    29
    +from daklib.config import Config
    
    30
    +
    
    31
    +views = [
    
    32
    +    'obsolete_all_associations',
    
    33
    +    'obsolete_any_associations',
    
    34
    +    'obsolete_any_by_all_associations',
    
    35
    +    'obsolete_src_associations',
    
    36
    +    'almost_obsolete_all_associations',
    
    37
    +    'almost_obsolete_src_associations',
    
    38
    +    'newest_all_associations',
    
    39
    +    'newest_any_associations',
    
    40
    +    'any_associations_source',
    
    41
    +    'binaries_suite_arch',
    
    42
    +    'file_arch_suite',
    
    43
    +    'src_associations_bin',
    
    44
    +    'suite_arch_by_name',
    
    45
    +]
    
    46
    +
    
    47
    +sequences = [
    
    48
    +    'location_id_seq',
    
    49
    +]
    
    50
    +
    
    51
    +################################################################################
    
    52
    +
    
    53
    +
    
    54
    +def do_update(self):
    
    55
    +    print __doc__
    
    56
    +    try:
    
    57
    +        cnf = Config()
    
    58
    +
    
    59
    +        c = self.db.cursor()
    
    60
    +
    
    61
    +        for i in views:
    
    62
    +            c.execute("DROP VIEW {0}".format(i))
    
    63
    +
    
    64
    +        for i in sequences:
    
    65
    +            c.execute("DROP SEQUENCE {0}".format(i))
    
    66
    +
    
    67
    +        c.execute("UPDATE config SET value = '119' WHERE name = 'db_revision'")
    
    68
    +        self.db.commit()
    
    69
    +
    
    70
    +    except psycopg2.ProgrammingError as msg:
    
    71
    +        self.db.rollback()
    
    72
    +        raise DBUpdateError('Unable to apply sick update 119, rollback issued. Error message: {0}'.format(msg))

  • daklib/dbconn.py
    ... ... @@ -2198,26 +2198,13 @@ class DBConn(object):
    2198 2198
         )
    
    2199 2199
     
    
    2200 2200
         views = (
    
    2201
    -        'almost_obsolete_all_associations',
    
    2202
    -        'almost_obsolete_src_associations',
    
    2203
    -        'any_associations_source',
    
    2204 2201
             'bin_associations_binaries',
    
    2205
    -        'binaries_suite_arch',
    
    2206 2202
             'changelogs',
    
    2207
    -        'file_arch_suite',
    
    2208
    -        'newest_all_associations',
    
    2209
    -        'newest_any_associations',
    
    2210 2203
             'newest_source',
    
    2211 2204
             'newest_src_association',
    
    2212
    -        'obsolete_all_associations',
    
    2213
    -        'obsolete_any_associations',
    
    2214
    -        'obsolete_any_by_all_associations',
    
    2215
    -        'obsolete_src_associations',
    
    2216 2205
             'package_list',
    
    2217 2206
             'source_suite',
    
    2218
    -        'src_associations_bin',
    
    2219 2207
             'src_associations_src',
    
    2220
    -        'suite_arch_by_name',
    
    2221 2208
         )
    
    2222 2209
     
    
    2223 2210
         def __init__(self, *args, **kwargs):
    


  • Reply to: