Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(attachments): add xform and user fields to Attachment model TASK-927 #5575

Merged
merged 6 commits into from
Mar 13, 2025

Conversation

RuthShryock
Copy link
Member

@RuthShryock RuthShryock commented Mar 7, 2025

👀 Preview steps

  1. Check out the kobocat database: ./manage.py dbshell --database kobocat
  2. Look at the attachment table: \d logger_attachment
  3. Verify that the Attachment table has the new fields:

                                     Table "public.logger_attachment"
       Column        |           Type           | Collation | Nullable |             Default          
    
---------------------+--------------------------+-----------+----------+------------------------------
----
 id                  | integer                  |           | not null | generated by default as ident
ity
 media_file          | character varying(380)   |           | not null | 
 mimetype            | character varying(100)   |           | not null | 
 instance_id         | integer                  |           | not null | 
 media_file_basename | character varying(260)   |           |          | 
 media_file_size     | integer                  |           |          | 
 deleted_at          | timestamp with time zone |           |          | 
 user_id             | integer                  |           |          | 
 xform_id            | integer                  |           |          | 
Indexes:
    "logger_attachment_pkey" PRIMARY KEY, btree (id)
    "logger_attachment_deleted_at_5d62193e" btree (deleted_at)
    "logger_attachment_instance_id_780c30f1" btree (instance_id)
    "logger_attachment_media_file_18cea505" btree (media_file)
    "logger_attachment_media_file_18cea505_like" btree (media_file varchar_pattern_ops)
    "logger_attachment_media_file_basename_164242ca" btree (media_file_basename)
    "logger_attachment_media_file_basename_164242ca_like" btree (media_file_basename varchar_pattern_ops)
    "logger_attachment_user_id_4fde878d" btree (user_id)
    "logger_attachment_xform_id_22b4fd1f" btree (xform_id)
Check constraints:
    "logger_attachment_media_file_size_check" CHECK (media_file_size >= 0)
Foreign-key constraints:
    "logger_attachment_instance_id_780c30f1_fk_logger_instance_id" FOREIGN KEY (instance_id) REFERENCE:

RuthShryock and others added 3 commits March 5, 2025 14:11
…5571)

### 🗒️ Checklist

1. [X] run linter locally
2. [X] update all related docs (API, README, inline, etc.), if any
3. [X] draft PR with a title `<type>(<scope>)<!>: <title> TASK-1234`
4. [X] tag PR: at least `frontend` or `backend` unless it's global
5. [X] fill in the template below and delete template comments
6. [X] review thyself: read the diff and repro the preview as written
7. [X] open PR & confirm that CI passes
8. [X] request reviewers, if needed
9. [ ] delete this section before merging

### 💭 Notes
Error from #5568. The Leaflet
library needs to have the L object imported before other leaflet
imports.

### 👀 Preview steps

1. ℹ️ have an account and a project
2. Navigate to the Project Summary page
4. 🔴 [on main] notice that if you click on "Data" or "Settings", an
error message is shown
5. 🟢 [on PR] notice that you can click on and view the "Data" and
"Settings" pages
@RuthShryock RuthShryock self-assigned this Mar 7, 2025
@RuthShryock RuthShryock changed the title feat(attachments): add xform and user fields to Attachment model Task-927 feat(attachments): add xform and user fields to Attachment model TASK-927 Mar 7, 2025
Comment on lines 21 to 42
migrations.AddField(
model_name='attachment',
name='user',
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name='attachments',
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name='attachment',
name='xform',
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name='attachments',
to='logger.xform',
),
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration should only contain change to the Attachment model. Remove all other changes that Django has detected (because misc differences between your environment and the production).
Please change the name of the file too to make it obvious about the changes we are applying.

@RuthShryock RuthShryock requested a review from noliveleger March 11, 2025 15:00
Copy link
Contributor

@noliveleger noliveleger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RuthShryock RuthShryock merged commit 846ca60 into release/2.025.10 Mar 13, 2025
5 checks passed
@RuthShryock RuthShryock deleted the task-927-add-xform-and-user-fields branch March 13, 2025 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants