Skip to content

Commit 599933c

Browse files
authored
ref(teams): Add column to organization access request (#16333)
1 parent 84fa290 commit 599933c

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.9.13 on 2020-01-08 06:35
3+
from __future__ import unicode_literals
4+
5+
from django.conf import settings
6+
from django.db import migrations
7+
import django.db.models.deletion
8+
import sentry.db.models.fields.foreignkey
9+
10+
11+
class Migration(migrations.Migration):
12+
# This flag is used to mark that a migration shouldn't be automatically run in
13+
# production. We set this to True for operations that we think are risky and want
14+
# someone from ops to run manually and monitor.
15+
# General advice is that if in doubt, mark your migration as `is_dangerous`.
16+
# Some things you should always mark as dangerous:
17+
# - Adding indexes to large tables. These indexes should be created concurrently,
18+
# unfortunately we can't run migrations outside of a transaction until Django
19+
# 1.10. So until then these should be run manually.
20+
# - Large data migrations. Typically we want these to be run manually by ops so that
21+
# they can be monitored. Since data migrations will now hold a transaction open
22+
# this is even more important.
23+
# - Adding columns to highly active tables, even ones that are NULL.
24+
is_dangerous = False
25+
26+
27+
dependencies = [
28+
('sentry', '0024_auto_20191230_2052'),
29+
]
30+
31+
operations = [
32+
migrations.AddField(
33+
model_name='organizationaccessrequest',
34+
name='requester',
35+
field=sentry.db.models.fields.foreignkey.FlexibleForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
36+
),
37+
]
38+
39+
40+
# BEGIN;
41+
# --
42+
# -- Add field requester to organizationaccessrequest
43+
# --
44+
# ALTER TABLE "sentry_organizationaccessrequest" ADD COLUMN "requester_id" integer NULL;
45+
# ALTER TABLE "sentry_organizationaccessrequest" ALTER COLUMN "requester_id" DROP DEFAULT;
46+
# CREATE INDEX "sentry_organizationaccessrequest_573f8683" ON "sentry_organizationaccessrequest" ("requester_id");
47+
# ALTER TABLE "sentry_organizationaccessrequest" ADD CONSTRAINT "sentry_organizationaccess_requester_id_73de4b1e_fk_auth_user_id" FOREIGN KEY ("requester_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
48+
49+
# COMMIT;

src/sentry/models/organizationaccessrequest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import absolute_import, print_function
22

3+
from django.conf import settings
34
from django.core.urlresolvers import reverse
45
from django.db.models import Q
56

@@ -13,6 +14,8 @@ class OrganizationAccessRequest(Model):
1314

1415
team = FlexibleForeignKey("sentry.Team")
1516
member = FlexibleForeignKey("sentry.OrganizationMember")
17+
# access request from a different user than the member
18+
requester = FlexibleForeignKey(settings.AUTH_USER_MODEL, null=True)
1619

1720
class Meta:
1821
app_label = "sentry"

0 commit comments

Comments
 (0)