ephraimbuddy commented on code in PR #23444:
URL: https://github.com/apache/airflow/pull/23444#discussion_r864253629
##########
airflow/migrations/utils.py:
##########
@@ -35,7 +35,8 @@ def get_mssql_table_constraints(conn, table_name):
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS tc
JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS ccu ON
ccu.CONSTRAINT_NAME = tc.CONSTRAINT_NAME
WHERE tc.TABLE_NAME = '{table_name}' AND
- (tc.CONSTRAINT_TYPE = 'PRIMARY KEY' or UPPER(tc.CONSTRAINT_TYPE) =
'UNIQUE')
+ (tc.CONSTRAINT_TYPE = 'PRIMARY KEY' or UPPER(tc.CONSTRAINT_TYPE) =
'UNIQUE'
+ or UPPER(tc.CONSTRAINT_TYPE) = 'FOREIGN KEY')
Review Comment:
I don't think there's any other migration that tried dropping an unnamed
foreign key in `MSSQL`. Most other foreign keys are named and easily dropped.
This particular case is one of those unnamed foreign keys. There's no other way
to drop unnamed foreign key in MSSQL other than using this query or using
sqlalchemy `inspect`.
For the one that's not uppercased, it has been like that and working. My
addition to the code is that of foreign key.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]