summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Cope <olly@ollycope.com>2018-08-04 18:58:41 +0000
committerOlly Cope <olly@ollycope.com>2018-08-04 18:58:41 +0000
commit81073037836f69b3b16cb3a5a6c9c27d9f0e01a6 (patch)
tree60752bfbdbdb96d347b4b446dfc00c30c3e18230
parent801eecbc5c79123d1aba45bf53ce0f95bfaf8ff9 (diff)
downloadyoyo-81073037836f69b3b16cb3a5a6c9c27d9f0e01a6.tar.gz
Include database name in list_table_sql query
-rw-r--r--yoyo/backends.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yoyo/backends.py b/yoyo/backends.py
index d48e5df..e378055 100644
--- a/yoyo/backends.py
+++ b/yoyo/backends.py
@@ -121,7 +121,8 @@ class DatabaseBackend(object):
pid INT NOT NULL,
PRIMARY KEY (locked)
)"""
- list_tables_sql = "SELECT table_name FROM information_schema.tables"
+ list_tables_sql = ("SELECT table_name FROM information_schema.tables "
+ "WHERE table_schema = :database")
is_applied_sql = """
SELECT COUNT(1) FROM {0.migration_table_quoted}
WHERE id=:id"""
@@ -207,7 +208,8 @@ class DatabaseBackend(object):
This is used by the test suite to clean up tables
generated during testing
"""
- cursor = self.execute(self.list_tables_sql)
+ cursor = self.execute(self.list_tables_sql,
+ {'database': self.uri.database})
return [row[0] for row in cursor.fetchall()]
def transaction(self):