@@ -0,0 +1,1649 @@
+%22%22%22empty message%0A%0ARevision ID: 0028_add_default_permissions%0ARevises: 0027_add_service_permission%0ACreate Date: 2016-02-26 10:33:20.536362%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '0028_add_default_permissions'%0Adown_revision = '0027_add_service_permission'%0Aimport uuid%0Afrom datetime import datetime%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Afrom sqlalchemy.dialects import postgresql%0A%0Adef upgrade():%0A    ### commands auto generated by Alembic - please adjust! ###%0A    conn = op.get_bind()%0A    user_services = conn.execute(%22SELECT * FROM user_to_service%22).fetchall()%0A    for entry in user_services:%0A        id_ = uuid.uuid4()%0A        created_at = datetime.now().isoformat().replace('T', ' ')%0A        conn.execute((%0A            %22INSERT INTO permissions (id, user_id, service_id, permission, created_at)%22%0A            %22 VALUES ('%7B%7D', '%7B%7D', '%7B%7D', 'manage_service', '%7B%7D')%22).format(id_, entry%5B0%5D, entry%5B1%5D, created_at))%0A        id_ = uuid.uuid4()%0A        conn.execute((%0A            %22INSERT INTO permissions (id, user_id, service_id, permission, created_at)%22%0A            %22 VALUES ('%7B%7D', '%7B%7D', '%7B%7D', 'send_messages', '%7B%7D')%22).format(id_, entry%5B0%5D, entry%5B1%5D, created_at))%0A        id_ = uuid.uuid4()%0A        conn.execute((%0A            %22INSERT INTO permissions (id, user_id, service_id, permission, created_at)%22%0A            %22 VALUES ('%7B%7D', '%7B%7D', '%7B%7D', 'manage_api_keys', '%7B%7D')%22).format(id_, entry%5B0%5D, entry%5B1%5D, created_at))%0A    ### end Alembic commands ###%0A%0A%0Adef downgrade():%0A    ### commands auto generated by Alembic - please adjust! ###%0A    conn = op.get_bind()%0A    conn.execute(%22DELETE FROM permissions%22)%0A%0A    ### end Alembic commands ###

Add default permissions for existing services.