Skip to content

Conversation

@mShan0
Copy link
Contributor

@mShan0 mShan0 commented Apr 26, 2024

No description provided.

mShan0 and others added 10 commits March 14, 2024 16:24
* Fix param format bug

* fix null case

---------

Co-authored-by: mShan0 <96149598+mShan0@users.noreply.github.com>
If we don't use this `where` this query returns the tables from all the schemas and not just the schema we are looking for.  Filter applied in the `left join` does not have the expected result in this scenario.

Just run the query below and you see what I mean
```sql
SELECT
                        TABLE_NAME,
                        i.TABLE_SCHEMA,
                        TABLE_TYPE,
                        CAST(ep.value AS VARCHAR) AS COMMENT
                    FROM INFORMATION_SCHEMA.TABLES i
                    LEFT JOIN sys.tables t ON t.name = i.TABLE_NAME
                    LEFT JOIN sys.extended_properties ep ON t.object_id = ep.major_id
                    AND ((ep.name = 'MS_DESCRIPTION' AND ep.minor_id = 0) OR ep.value IS NULL)
                    AND i.TABLE_SCHEMA = 'my_dev_schema'
```

If we have in the same database one schema the has the django_migrations but we are then running our application, that does not have migrations, against a different schema, this bit here breaks the application. The function has_table() will return True, but it should return False, because out schema does NOT have the table.
@mShan0 mShan0 merged commit 9f0f562 into master Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants