dev: fix migrations and update nginx migration

This commit is contained in:
pablohashescobar 2024-02-12 13:19:26 +05:30
parent 0f0e86fdb4
commit 79685b33d6
5 changed files with 36 additions and 46 deletions

View File

@ -5,6 +5,26 @@ from django.conf import settings
import django.db.models
import plane.db.models.asset
def widgets_filter_change(apps, schema_editor):
Widget = apps.get_model("db", "Widget")
widgets_to_update = []
# Define the filter dictionaries for each widget key
filters_mapping = {
"assigned_issues": {"duration": "none", "tab": "pending"},
"created_issues": {"duration": "none", "tab": "pending"},
"issues_by_state_groups": {"duration": "none"},
"issues_by_priority": {"duration": "none"},
}
# Iterate over widgets and update filters if applicable
for widget in Widget.objects.all():
if widget.key in filters_mapping:
widget.filters = filters_mapping[widget.key]
widgets_to_update.append(widget)
# Bulk update the widgets
Widget.objects.bulk_update(widgets_to_update, ["filters"], batch_size=10)
def update_user_urls(apps, schema_editor):
# Check if the app is using minio or s3
@ -245,4 +265,5 @@ class Migration(migrations.Migration):
migrations.RunPython(update_user_urls),
migrations.RunPython(update_workspace_urls),
migrations.RunPython(update_project_urls),
migrations.RunPython(widgets_filter_change),
]

View File

@ -1,33 +0,0 @@
# Generated by Django 4.2.7 on 2024-02-08 09:57
from django.db import migrations
def widgets_filter_change(apps, schema_editor):
Widget = apps.get_model("db", "Widget")
widgets_to_update = []
# Define the filter dictionaries for each widget key
filters_mapping = {
"assigned_issues": {"duration": "none", "tab": "pending"},
"created_issues": {"duration": "none", "tab": "pending"},
"issues_by_state_groups": {"duration": "none"},
"issues_by_priority": {"duration": "none"},
}
# Iterate over widgets and update filters if applicable
for widget in Widget.objects.all():
if widget.key in filters_mapping:
widget.filters = filters_mapping[widget.key]
widgets_to_update.append(widget)
# Bulk update the widgets
Widget.objects.bulk_update(widgets_to_update, ["filters"], batch_size=10)
class Migration(migrations.Migration):
dependencies = [
('db', '0058_alter_moduleissue_issue_and_more'),
]
operations = [
migrations.RunPython(widgets_filter_change)
]

View File

@ -41,9 +41,9 @@ class Migration(migrations.Migration):
migrations.DeleteModel(
name="IssueAttachment",
),
migrations.AddField(
model_name='cycle',
name='progress_snapshot',
field=models.JSONField(default=dict),
),
# migrations.AddField(
# model_name='cycle',
# name='progress_snapshot',
# field=models.JSONField(default=dict),
# ),
]

View File

@ -16,12 +16,6 @@ http {
add_header Permissions-Policy "interest-cohort=()" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Host ${dollar}host;
add_header X-Real-IP ${dollar}remote_addr;
add_header X-Forwarded-For ${dollar}proxy_add_x_forwarded_for;
add_header X-Forwarded-Proto ${dollar}scheme;
location / {
proxy_pass http://web:3000/;
proxy_http_version 1.1;
@ -30,16 +24,20 @@ http {
}
location /api/ {
proxy_set_header Host ${dollar}host;
proxy_set_header X-Real-IP ${dollar}remote_addr;
proxy_set_header X-Forwarded-For ${dollar}proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto ${dollar}scheme;
proxy_pass http://api:8000/api/;
}
location /spaces/ {
rewrite ^/spaces/?$ /spaces/login break;
proxy_pass http://space:4000/spaces/;
}
location /${BUCKET_NAME}/ {
proxy_pass http://plane-minio:9000/uploads/;
proxy_pass http://plane-minio:9000/${BUCKET_NAME}/;
}
}
}

View File

@ -26,6 +26,10 @@ http {
}
location /api/ {
proxy_set_header Host ${dollar}host;
proxy_set_header X-Real-IP ${dollar}remote_addr;
proxy_set_header X-Forwarded-For ${dollar}proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto ${dollar}scheme;
proxy_pass http://api:8000/api/;
}