"""user_created_by

Revision: 0178
Revision ID: 3c5285bbbb66
Revises: 23727a96713b
Create Date: 2020-04-07 22:40:27.380724

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


# revision identifiers, used by Alembic.
revision = '3c5285bbbb66'
down_revision = '23727a96713b'
branch_labels = None
depends_on = None


def upgrade():
    op.add_column('users', sa.Column('created_by_id', sa.Integer(), nullable=True))
    op.add_column('users', sa.Column('invited_by_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'users', 'users', ['created_by_id'], ['id'], ondelete='SET NULL')
    op.create_foreign_key(None, 'users', 'users', ['invited_by_id'], ['id'], ondelete='SET NULL')


def downgrade():
    op.drop_column('users', 'created_by_id')
    op.drop_column('users', 'invited_by_id')
