Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Drop database leftovers of the legacy digital content feature [ENG-1375] (#19550)

Lukasz Ostrowski701e85086552
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7452aad5aa..ec9df038a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,8 @@ All notable, unreleased changes to this project will be documented in this file.
- Removed the deprecated `shopDomainUpdate` mutation. Use the `PUBLIC_URL` environment variable to configure the shop domain instead.
- Removed the deprecated `orderSettingsUpdate` mutation. Use the `channelUpdate` mutation with the `orderSettings` input to update order settings per channel instead.
- Removed the deprecated `orderSettings` query field. Use the `channel` query and read its `orderSettings` field instead.
+- Removed the `DIGITAL_LINKS` value from the `OrderEventsEmailsEnum` enum and the `DIGITAL_LINK_DOWNLOADED` value from the `CustomerEventsEnum` enum. Events with these types were deleted in 3.23, along with the legacy digital content feature that emitted them.
+- Removed the always-empty `digital_lines` key from the fulfillment confirmation notification payload. Use `physical_lines`, which holds every line of the fulfillment.
### GraphQL API
@@ -34,6 +36,10 @@ All notable, unreleased changes to this project will be documented in this file.
### Other changes
+- Dropped the database leftovers of the legacy digital content feature removed in 3.23: the `product_digitalcontent` and `product_digitalcontenturl` tables, and the `automatic_fulfillment_digital_products`, `default_digital_max_downloads` and `default_digital_url_valid_days` columns of `site_sitesettings`. Files uploaded through the legacy API are not removed from the media storage — the `digital_contents/` directory can be deleted manually.
+- `ProductType.is_digital` was removed from the ORM model; the column itself will be dropped in 3.25.
+- Removed the `is_digital` field from the `populatedb` sample data.
+
#### Search improvements
### Deprecations
diff --git a/saleor/account/__init__.py b/saleor/account/__init__.py
index bfb2d8c4d9..e352e5dce9 100755
--- a/saleor/account/__init__.py
+++ b/saleor/account/__init__.py
@@ -15,9 +15,6 @@ class CustomerEvents:
PLACED_ORDER = "placed_order" # created an order
NOTE_ADDED_TO_ORDER = "note_added_to_order" # added a note to one of their orders
- # Kept to ensure zero-downtime migrations - will be removed in Saleor v3.24.0
- DIGITAL_LINK_DOWNLOADED = "digital_link_downloaded" # downloaded a digital good
-
# Staff actions over customers events
CUSTOMER_DELETED = "customer_deleted" # staff user deleted a customer
EMAIL_ASSIGNED = "email_assigned" # the staff user assigned a email to the customer
@@ -38,7 +35,6 @@ class CustomerEvents:
(EMAIL_CHANGED, "The account email address was changed"),
(PLACED_ORDER, "An order was placed"),
(NOTE_ADDED_TO_ORDER, "A note was added"),
- (DIGITAL_LINK_DOWNLOADED, "A digital good was downloaded"),
(CUSTOMER_DELETED, "A customer was deleted"),
(NAME_ASSIGNED, "A customer's name was edited"),
(EMAIL_ASSIGNED, "A customer's email address was edited"),
diff --git a/saleor/account/migrations/0100_remove_digital_link_from_customerevent_type.py b/saleor/account/migrations/0100_remove_digital_link_from_customerevent_type.py
new file mode 100644
index 0000000000..e36e2d005e
--- /dev/null
+++ b/saleor/account/migrations/0100_remove_digital_link_from_customerevent_type.py
@@ -0,0 +1,35 @@
+# Generated by Django 5.2.16 on 2026-07-27 12:26
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("account", "0099_remove_digitalcontent_customerevent_type"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="customerevent",
+ name="type",
+ field=models.CharField(
+ choices=[
+ ("ACCOUNT_CREATED", "account_created"),
+ ("ACCOUNT_ACTIVATED", "account_activated"),
+ ("ACCOUNT_DEACTIVATED", "account_deactivated"),
+ ("PASSWORD_RESET_LINK_SENT", "password_reset_link_sent"),
+ ("PASSWORD_RESET", "password_reset"),
+ ("EMAIL_CHANGED_REQUEST", "email_changed_request"),
+ ("PASSWORD_CHANGED", "password_changed"),
+ ("EMAIL_CHANGED", "email_changed"),
+ ("PLACED_ORDER", "placed_order"),
+ ("NOTE_ADDED_TO_ORDER", "note_added_to_order"),
+ ("CUSTOMER_DELETED", "customer_deleted"),
+ ("NAME_ASSIGNED", "name_assigned"),
+ ("EMAIL_ASSIGNED", "email_assigned"),
+ ("NOTE_ADDED", "note_added"),
+ ],
+ max_length=255,
+ ),
+ ),
+ ]
diff --git a/saleor/graphql/product/tests/queries/test_product_types_query.py b/saleor/graphql/product/tests/queries/test_product_types_query.py
index 938e34ad90..5cd8b2b251 100644
--- a/saleor/graphql/product/tests/queries/test_product_types_query.py
+++ b/saleor/graphql/product/tests/queries/test_product_types_query.py
@@ -68,7 +68,6 @@ def test_product_type_query_with_filter(
slug="digital-type",
has_variants=True,
is_shipping_required=False,
- is_digital=True,
kind=ProductTypeKind.NORMAL,
),
ProductType(
@@ -76,7 +75,6 @@ def test_product_type_query_with_filter(
slug="tools",
has_variants=True,
is_shipping_required=True,
- is_digital=False,
kind=ProductTypeKind.NORMAL,
),
ProductType(
@@ -84,7 +82,6 @@ def test_product_type_query_with_filter(
slug="books",
has_variants=False,
is_shipping_required=True,
- is_digital=False,
kind=ProductTypeKind.GIFT_CARD,
),
]
@@ -138,21 +135,18 @@ def test_product_type_query_with_sort(
slug="digital",
has_variants=True,
is_shipping_required=False,
- is_digital=True,
),
ProductType(
name="Tools",
slug="tools",
has_variants=True,
is_shipping_required=True,
- is_digital=False,
),
ProductType(
name="Subscription",
slug="subscription",
has_variants=False,
is_shipping_required=False,
- is_digital=False,
),
]
)
diff --git a/saleor/graphql/product/tests/test_product_pagination.py b/saleor/graphql/product/tests/test_product_pagination.py
index 0213eb6c99..f40919adde 100644
--- a/saleor/graphql/product/tests/test_product_pagination.py
+++ b/saleor/graphql/product/tests/test_product_pagination.py
@@ -859,32 +859,27 @@ def product_types_for_pagination(db):
ProductType(
name="ProductType1",
slug="pt_1",
- is_digital=True,
is_shipping_required=False,
),
ProductType(
name="ProductTypeProductType1",
slug="pt_pt_1",
- is_digital=False,
is_shipping_required=False,
),
ProductType(
name="ProductTypeProductType2",
slug="pt_pt_2",
- is_digital=False,
is_shipping_required=True,
),
ProductType(
name="ProductType2",
slug="pt_2",
- is_digital=False,
is_shipping_required=True,
has_variants=False,
),
ProductType(
name="ProductType3",
slug="pt_3",
- is_digital=True,
is_shipping_required=False,
has_variants=False,
),
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 8de97fe8cd..4a6952d360 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -13085,7 +13085,6 @@ enum OrderEventsEmailsEnum @doc(category: "Orders") {
ORDER_CANCEL
ORDER_REFUND
FULFILLMENT_CONFIRMATION
- DIGITAL_LINKS
}
type OrderEventOrderLineObject @doc(category: "Orders") {
@@ -13852,7 +13851,6 @@ enum CustomerEventsEnum @doc(category: "Users") {
EMAIL_CHANGED
PLACED_ORDER
NOTE_ADDED_TO_ORDER
- DIGITAL_LINK_DOWNLOADED
CUSTOMER_DELETED
NAME_ASSIGNED
EMAIL_ASSIGNED
diff --git a/saleor/order/__init__.py b/saleor/order/__init__.py
index e0693c4a3a..efd30a5fee 100644
--- a/saleor/order/__init__.py
+++ b/saleor/order/__init__.py
@@ -219,9 +219,6 @@ class OrderEventsEmails:
ORDER_REFUND = "order_refund"
FULFILLMENT = "fulfillment_confirmation"
- # Kept to ensure zero-downtime migrations - will be removed in Saleor v3.24.0
- DIGITAL_LINKS = "digital_links"
-
CHOICES = [
(PAYMENT, "The payment confirmation email was sent"),
(CONFIRMED, "The order confirmed email was sent"),
@@ -231,7 +228,6 @@ class OrderEventsEmails:
(ORDER_CANCEL, "The order cancel confirmation email was sent"),
(ORDER_REFUND, "The order refund confirmation email was sent"),
(FULFILLMENT, "The fulfillment confirmation email was sent"),
- (DIGITAL_LINKS, "The email containing the digital links was sent"),
]
diff --git a/saleor/order/notifications.py b/saleor/order/notifications.py
index 6e8edb584a..0971d53cec 100644
--- a/saleor/order/notifications.py
+++ b/saleor/order/notifications.py
@@ -394,9 +394,6 @@ def get_default_fulfillment_payload(order, fulfillment):
"physical_lines": [
get_default_fulfillment_line_payload(line, attribute_data) for line in lines
],
- # Note: saleor keeps 'digital_lines' for backward compatibility but this
- # may be removed once ProductType supports metadata
- "digital_lines": [],
"recipient_email": order.get_customer_email(),
**get_site_context(),
}
diff --git a/saleor/order/tests/test_notifications.py b/saleor/order/tests/test_notifications.py
index be40870e6b..1906a2aa6e 100644
--- a/saleor/order/tests/test_notifications.py
+++ b/saleor/order/tests/test_notifications.py
@@ -328,7 +328,6 @@ def test_get_default_fulfillment_payload(fulfillment, site_settings):
"tracking_number": fulfillment.tracking_number,
"is_tracking_number_url": fulfillment.is_tracking_number_url,
},
- "digital_lines": [],
"recipient_email": order.get_customer_email(),
**get_site_context_payload(site_settings.site),
}
diff --git a/saleor/plugins/user_email/tests/test_tasks.py b/saleor/plugins/user_email/tests/test_tasks.py
index 96499a4b8d..3c104c5dbb 100644
--- a/saleor/plugins/user_email/tests/test_tasks.py
+++ b/saleor/plugins/user_email/tests/test_tasks.py
@@ -658,7 +658,6 @@ def test_send_fulfillment_confirmation_email_task_custom_template_by_user(
payload = get_default_fulfillment_payload(order, fulfillment)
payload["requester_user_id"] = to_global_id_or_none(staff_user)
payload["requester_app_id"] = None
- payload["digital_lines"] = []
recipient_email = payload["recipient_email"]
send_fulfillment_confirmation_email_task(
@@ -705,7 +704,6 @@ def test_send_fulfillment_confirmation_email_task_custom_template_by_app(
payload = get_default_fulfillment_payload(order, fulfillment)
payload["requester_user_id"] = None
payload["requester_app_id"] = to_global_id_or_none(app)
- payload["digital_lines"] = []
recipient_email = payload["recipient_email"]
send_fulfillment_confirmation_email_task(
diff --git a/saleor/product/migrations/0206_drop_digitalcontent_tables.py b/saleor/product/migrations/0206_drop_digitalcontent_tables.py
new file mode 100644
index 0000000000..42137ffef4
--- /dev/null
+++ b/saleor/product/migrations/0206_drop_digitalcontent_tables.py
@@ -0,0 +1,24 @@
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ """Drop the legacy digital content tables.
+
+ Both models were removed from the Django state in
+ `0204_remove_digitalcontent_from_state` (Saleor 3.23), so no running pod
+ reads or writes these tables anymore.
+ """
+
+ dependencies = [("product", "0205_merge_20260615_1308")]
+
+ operations = [
+ migrations.RunSQL(
+ # Drop the child table first, it holds a FK to product_digitalcontent.
+ sql="DROP TABLE IF EXISTS product_digitalcontenturl;",
+ reverse_sql=migrations.RunSQL.noop,
+ ),
+ migrations.RunSQL(
+ sql="DROP TABLE IF EXISTS product_digitalcontent;",
+ reverse_sql=migrations.RunSQL.noop,
+ ),
+ ]
diff --git a/saleor/product/migrations/0207_remove_producttype_is_digital_from_state.py b/saleor/product/migrations/0207_remove_producttype_is_digital_from_state.py
new file mode 100644
index 0000000000..dbdc6947cd
--- /dev/null
+++ b/saleor/product/migrations/0207_remove_producttype_is_digital_from_state.py
@@ -0,0 +1,33 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ """Remove `ProductType.is_digital` from the Django state.
+
+ The whole GraphQL surface of the field was removed in Saleor 3.24.0, but
+ the column has to stay for one release so that pods running the previous
+ version keep working during a rolling deploy.
+ """
+
+ dependencies = [("product", "0206_drop_digitalcontent_tables")]
+
+ operations = [
+ migrations.SeparateDatabaseAndState(
+ database_operations=[
+ migrations.AlterField(
+ model_name="producttype",
+ name="is_digital",
+ # Adds 'db_default=False' so INSERTs that no longer include
+ # the column don't violate its NOT NULL constraint.
+ field=models.BooleanField(default=False, db_default=False),
+ ),
+ ],
+ # Will be dropped from the actual DB in Saleor v3.25.0
+ state_operations=[
+ migrations.RemoveField(
+ model_name="producttype",
+ name="is_digital",
+ ),
+ ],
+ )
+ ]
diff --git a/saleor/product/models.py b/saleor/product/models.py
index 0c31499b52..6bcd11c2a8 100644
--- a/saleor/product/models.py
+++ b/saleor/product/models.py
@@ -129,11 +129,8 @@ class ProductType(ModelWithMetadata):
slug = models.SlugField(max_length=255, unique=True, allow_unicode=True)
kind = models.CharField(max_length=32, choices=ProductTypeKind.CHOICES)
is_shipping_required = models.BooleanField(default=True)
-
- # TODO: remove this column with a migration. Has no effect and the whole
- # GraphQL surface (field, input, filter, sort) was removed in v3.24.0.
- is_digital = models.BooleanField(default=False)
-
+ # Note: the table still has an `is_digital` column, detached from this model in
+ # migration 0207. It is dropped from the DB in 3.25.
weight = MeasurementField(
measurement=Weight,
unit_choices=WeightUnits.CHOICES,
diff --git a/saleor/site/migrations/0052_drop_digital_content_settings.py b/saleor/site/migrations/0052_drop_digital_content_settings.py
new file mode 100644
index 0000000000..3cecfc5a7d
--- /dev/null
+++ b/saleor/site/migrations/0052_drop_digital_content_settings.py
@@ -0,0 +1,37 @@
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ """Drop the legacy digital content shop settings columns.
+
+ The fields were removed from the Django state in
+ `0046_remove_digital_content_settings_from_state` (Saleor 3.23), so no
+ running pod reads or writes these columns anymore.
+ """
+
+ dependencies = [("site", "0051_merge_20260717_1400")]
+
+ operations = [
+ migrations.SeparateDatabaseAndState(
+ database_operations=[
+ # A single ALTER TABLE: dropping a column is a metadata-only
+ # operation, so one statement means one short lock instead of
+ # three.
+ migrations.RunSQL(
+ sql="""
+ ALTER TABLE site_sitesettings
+ DROP COLUMN automatic_fulfillment_digital_products,
+ DROP COLUMN default_digital_max_downloads,
+ DROP COLUMN default_digital_url_valid_days;
+ """,
+ reverse_sql="""
+ ALTER TABLE site_sitesettings
+ ADD COLUMN automatic_fulfillment_digital_products
+ BOOLEAN NOT NULL DEFAULT false,
+ ADD COLUMN default_digital_max_downloads INTEGER,
+ ADD COLUMN default_digital_url_valid_days INTEGER;
+ """,
+ )
+ ]
+ )
+ ]
diff --git a/saleor/static/populatedb_data.json b/saleor/static/populatedb_data.json
index 45a5341b36..daf3365791 100644
--- a/saleor/static/populatedb_data.json
+++ b/saleor/static/populatedb_data.json
@@ -409,7 +409,6 @@
"kind": "normal",
"has_variants": true,
"is_shipping_required": false,
- "is_digital": false,
"weight": "0.0:g"
}
},
@@ -424,7 +423,6 @@
"kind": "normal",
"has_variants": true,
"is_shipping_required": true,
- "is_digital": false,
"weight": "1000.0:g"
}
},
@@ -439,7 +437,6 @@
"kind": "normal",
"has_variants": false,
"is_shipping_required": true,
- "is_digital": false,
"weight": "1000.0:g"
}
},
@@ -454,7 +451,6 @@
"kind": "normal",
"has_variants": true,
"is_shipping_required": true,
- "is_digital": false,
"weight": "1000.0:g"
}
},
@@ -469,7 +465,6 @@
"kind": "normal",
"has_variants": false,
"is_shipping_required": true,
- "is_digital": false,
"weight": "1000.0:g"
}
},
@@ -484,7 +479,6 @@
"kind": "normal",
"has_variants": false,
"is_shipping_required": false,
- "is_digital": false,
"weight": "0.0:g"
}
},
@@ -499,7 +493,6 @@
"kind": "normal",
"has_variants": false,
"is_shipping_required": true,
- "is_digital": false,
"weight": "100.0:g"
}
},
@@ -514,7 +507,6 @@
"kind": "gift_card",
"has_variants": false,
"is_shipping_required": false,
- "is_digital": false,
"weight": "0.0:g"
}
},