11from pulpcore .plugin import PulpPluginAppConfig
2+ from django .db import connection
3+ from django .db .models .signals import post_migrate
4+
5+ update_sequences_to_bigint = """
6+ ALTER TABLE container_blobmanifest ALTER COLUMN id TYPE bigint;
7+ ALTER TABLE container_manifestlistmanifest ALTER COLUMN id TYPE bigint;
8+ ALTER TABLE container_containerpushrepository_pending_blobs ALTER COLUMN id TYPE bigint;
9+ ALTER TABLE container_containerpushrepository_pending_manifests ALTER COLUMN id TYPE bigint;
10+ ALTER TABLE container_containerrepository_pending_manifests ALTER COLUMN id TYPE bigint;
11+ ALTER TABLE container_containerrepository_pending_blobs ALTER COLUMN id TYPE bigint;
12+ ALTER SEQUENCE container_blobmanifest_id_seq AS BIGINT;
13+ ALTER SEQUENCE container_manifestlistmanifest_id_seq AS BIGINT;
14+ ALTER SEQUENCE container_containerpushrepository_pending_blobs_id_seq AS BIGINT;
15+ ALTER SEQUENCE container_containerpushrepository_pending_manifests_id_seq AS BIGINT;
16+ ALTER SEQUENCE container_containerrepository_pending_blobs_id_seq AS BIGINT;
17+ ALTER SEQUENCE container_containerrepository_pending_manifests_id_seq AS BIGINT;
18+ """
219
320
421class PulpContainerPluginAppConfig (PulpPluginAppConfig ):
@@ -10,6 +27,14 @@ class PulpContainerPluginAppConfig(PulpPluginAppConfig):
1027 python_package_name = "pulp-container"
1128 domain_compatible = True
1229
30+ @staticmethod
31+ def update_sequences (sender , ** kwargs ):
32+ """Update database sequences to bigint type after migrations."""
33+ with connection .cursor () as cursor :
34+ cursor .execute (update_sequences_to_bigint )
35+
1336 def ready (self ):
1437 super ().ready ()
1538 from . import checks
39+
40+ post_migrate .connect (PulpContainerPluginAppConfig .update_sequences , sender = self )
0 commit comments