Completed
Push — master ( 589bde...f684af )
by Egor
12s
created

grant_permissions()   A

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 8
rs 9.4285
1
# -*- coding: utf-8 -*-
2
from __future__ import unicode_literals
3
4
from django.conf import settings
5
from django.db import models, migrations, connection
6
7
def grant_permissions(apps, schema_editor):
8
    cursor = connection.cursor()
9
10
    cursor.execute('GRANT SELECT ON TABLE sparkle_sparkleversion, sparkle_sparkleversion_id_seq '
11
                   'TO GROUP %s;' % settings.DB_PUBLIC_ROLE)
12
13
    cursor.execute('GRANT USAGE, SELECT ON SEQUENCE sparkle_sparkleversion_id_seq '
14
                   'TO GROUP %s;' % settings.DB_PUBLIC_ROLE)
15
16
17
class Migration(migrations.Migration):
18
19
    dependencies = [
20
        ('sparkle', '0005_auto_20150707_0822'),
21
        ('omaha', '0021_grant_permissions_to_public_group'),
22
    ]
23
24
    operations = [
25
        migrations.RunPython(grant_permissions, reverse_code=migrations.RunPython.noop),
26
    ]
27