0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00
posthog/ee/migrations/0007_dashboard_permissions.py
Tom Owers 5513be7731
chore: upgraded Ruff linter (#18188)
* Upgraded Ruff linter

* Formatted whole codebase with new ruff rules

* Revert import removal

* Fixed mypi issues or added ignores

* Fixed schema formatting

* Fixed hogvm failing tests

* Remove duplicate key in list
2023-10-26 12:38:15 +02:00

68 lines
2.3 KiB
Python

# Generated by Django 3.2.5 on 2022-01-31 20:50
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import posthog.models.utils
class Migration(migrations.Migration):
dependencies = [
("posthog", "0203_dashboard_permissions"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("ee", "0006_event_definition_verification"),
]
operations = [
migrations.CreateModel(
name="DashboardPrivilege",
fields=[
(
"id",
models.UUIDField(
default=posthog.models.utils.UUIDT,
editable=False,
primary_key=True,
serialize=False,
),
),
(
"level",
models.PositiveSmallIntegerField(
choices=[
(21, "Everyone in the project can edit"),
(37, "Only those invited to this dashboard can edit"),
]
),
),
("added_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"dashboard",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="privileges",
related_query_name="privilege",
to="posthog.dashboard",
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="explicit_dashboard_privileges",
related_query_name="explicit_dashboard_privilege",
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.AddConstraint(
model_name="dashboardprivilege",
constraint=models.UniqueConstraint(
fields=("dashboard", "user"), name="unique_explicit_dashboard_privilege"
),
),
]