﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28463	Custom migrations that create a postgres role run against the production database during tests (postgres 9.6)	Simon Tomlinson	nobody	"Creating a custom migration that uses `migrations.RunSQL` to create a new postgres role and then running tests using `python manage.py test` creates the role in the real postgres server (when running postgres 9.6).

This doesn't happen with other custom sql, such as creating a type, which I found very odd.

Attached is a django project configured to connect to a postgres database running on localhost:5432, with a ""postgres"" user with no password and a postgres database. It contains an app called ""app"" with a single migration that executes `CREATE ROLE test_role`.

Run `python  manage.py test` and then inspect the database to reproduce. The role `test_role` should exist (list it with `\du` in psql).
Alternatively, run `python manage.py test` twice. It will crash the second time because the role already exists from the first run."	Bug	closed	Testing framework	1.11	Normal	invalid			Unreviewed	0	0	0	0	0	0
