~sircmpwn/meta.sr.ht

ref: 72548bd7545f78670878667674cc7645835a17bd meta.sr.ht/metasrht/alembic/versions/e3e51a076756_add_invites_for_normal_users.py -rw-r--r-- 1.0 KiB
72548bd7Drew DeVault API: Updates per core-go auth changes 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Add invites for normal users

Revision ID: e3e51a076756
Revises: 9caaf5055676
Create Date: 2018-08-16 20:05:37.336441

"""

# revision identifiers, used by Alembic.
revision = 'e3e51a076756'
down_revision = '9caaf5055676'

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.add_column('invite', sa.Column('sender_id', sa.Integer()))
    op.create_foreign_key('invite_sender_id_fkey',
            'invite', 'user', ['sender_id'], ['id'])
    op.add_column('invite', sa.Column('recipient_id', sa.Integer()))
    op.create_foreign_key('invite_recipient_id_fkey',
            'invite', 'user', ['recipient_id'], ['id'])
    op.add_column('user', sa.Column('invites',
        sa.Integer(), server_default='0'))


def downgrade():
    op.drop_constraint('invite_sender_id_fkey', 'invite', type_='foreignkey')
    op.drop_column('invite', 'sender_id')
    op.drop_constraint('invite_recipient_id_fkey', 'invite', type_='foreignkey')
    op.drop_column('invite', 'recipient_id')
    op.drop_column('user', 'invites')