Skip to content

Commit b9495d4

Browse files
Fix autogenerate with ON UPDATE / DELETE (#258)
Fix an issue where the regular expression incorrectly parses the foreign key constraint in case an `onupdate` / `ondelete` is present. Closes: 257 Signed-off-by: Iustin Dumitrescu <idumitrescu@drivenets.com>
1 parent 7bd628f commit b9495d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sqlalchemy_cockroachdb/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,10 @@ def _fk_regex_pattern(self):
375375
r"FOREIGN KEY \((.*?)\) "
376376
rf"REFERENCES (?:({qtoken})\.)?({qtoken})\(((?:{qtoken}(?: *, *)?)+)\)" # noqa: E501
377377
r"[\s]?(MATCH (FULL|PARTIAL|SIMPLE)+)?"
378-
r"[\s]?(ON UPDATE "
379-
r"(CASCADE|RESTRICT|NO ACTION|SET NULL|SET DEFAULT)+)?"
380378
r"[\s]?(ON DELETE "
381379
r"(CASCADE|RESTRICT|NO ACTION|SET NULL|SET DEFAULT)+)?"
380+
r"[\s]?(ON UPDATE "
381+
r"(CASCADE|RESTRICT|NO ACTION|SET NULL|SET DEFAULT)+)?"
382382
r"[\s]?(DEFERRABLE|NOT DEFERRABLE)?"
383383
r"[\s]?(INITIALLY (DEFERRED|IMMEDIATE)+)?"
384384
)

0 commit comments

Comments
 (0)