File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1414# must be replicated for each branch to ensure proper functionality
1515INCLUDE_MODELS = (
1616 'dcim.cablepath' ,
17+ 'extras.cachedvalue' ,
1718)
1819
1920# Models for which branching support is explicitly disabled
Original file line number Diff line number Diff line change @@ -518,15 +518,15 @@ def provision(self, user):
518518 cursor .execute (
519519 f"INSERT INTO { schema_table } SELECT * FROM { main_table } "
520520 )
521- # Get the name of the sequence used for object ID allocations
521+ # Get the name of the sequence used for object ID allocations (if one exists)
522522 cursor .execute (
523523 "SELECT pg_get_serial_sequence(%s, 'id')" , [table ]
524524 )
525- sequence_name = cursor .fetchone ()[0 ]
526525 # Set the default value for the ID column to the sequence associated with the source table
527- cursor .execute (
528- f"ALTER TABLE { schema_table } ALTER COLUMN id SET DEFAULT nextval(%s)" , [sequence_name ]
529- )
526+ if sequence_name := cursor .fetchone ()[0 ]:
527+ cursor .execute (
528+ f"ALTER TABLE { schema_table } ALTER COLUMN id SET DEFAULT nextval(%s)" , [sequence_name ]
529+ )
530530
531531 # Commit the transaction
532532 cursor .execute ("COMMIT" )
You can’t perform that action at this time.
0 commit comments