Update changes, refactor drop_database
This commit is contained in:
@@ -8,6 +8,7 @@ Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Fixed assert_max_length not working with non nullable columns
|
||||
- Add PostgreSQL < 9.2 support for drop_database
|
||||
|
||||
|
||||
0.27.5 (2014-10-24)
|
||||
|
@@ -399,8 +399,15 @@ def drop_database(url):
|
||||
engine.raw_connection().set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
|
||||
|
||||
# Disconnect all users from the database we are dropping.
|
||||
version = list(map(int, engine.execute('SHOW server_version;').first()[0].split('.')))
|
||||
pid_column = 'pid' if (version[0] >= 9 and version[1] >= 2) else 'procpid'
|
||||
version = list(
|
||||
map(
|
||||
int,
|
||||
engine.execute('SHOW server_version;').first()[0].split('.')
|
||||
)
|
||||
)
|
||||
pid_column = (
|
||||
'pid' if (version[0] >= 9 and version[1] >= 2) else 'procpid'
|
||||
)
|
||||
text = '''
|
||||
SELECT pg_terminate_backend(pg_stat_activity.%(pid_column)s)
|
||||
FROM pg_stat_activity
|
||||
|
Reference in New Issue
Block a user