Skip to content

Commit 690d7a9

Browse files
authored
Revert "Add indices on history table foreign keys"
1 parent 246f0f5 commit 690d7a9

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

temporal_sqlalchemy/clock.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ def build_clock_table(entity_table: sa.Table,
205205
entity_keys = set()
206206
for fk in util.foreign_key_to(entity_table, nullable=False):
207207
# this is done to support arbitrary primary key shape on entity
208-
# We don't add additional indices on the foreign keys here because
209-
# the uniqueness constraints will add an implicit index.
210208
clock_table.append_column(fk)
211209
entity_keys.add(fk.key)
212210

@@ -276,11 +274,7 @@ def _exclusion_in(type_, name) -> typing.Tuple:
276274

277275

278276
@_exclusion_in.register(sap.UUID)
279-
def _exclusion_in_uuid(type_, name):
280-
"""
281-
Cast UUIDs to text for our exclusion index because postgres doesn't
282-
currently allow GiST indices on UUIDs.
283-
"""
277+
def _(type_, name):
284278
return sa.cast(sa.text(name), sap.TEXT), '='
285279

286280

@@ -298,9 +292,7 @@ def build_history_table(
298292
table_name = util.truncate_identifier(
299293
_generate_history_table_name(local_table, columns)
300294
)
301-
# Build the foreign key(s), specifically adding an index since we may use
302-
# a casted foreign key in our constraints. See _exclusion_in_uuid
303-
entity_foreign_keys = list(util.foreign_key_to(local_table, index=True))
295+
entity_foreign_keys = list(util.foreign_key_to(local_table))
304296
entity_constraints = [
305297
_exclusion_in(fk.type, fk.key)
306298
for fk in entity_foreign_keys

temporal_sqlalchemy/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Version information."""
2-
__version__ = '0.4.2'
2+
__version__ = '0.4.1'

0 commit comments

Comments
 (0)