karenc / db-migrator

GNU Affero General Public License v3.0
4 stars 5 forks source link

Add super user database connections #43

Closed karenc closed 7 years ago

karenc commented 7 years ago

Add super_user() context manager that can be used in migrations when a database super user connection is necessary.

Close #38

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.1%) to 96.31% when pulling 6010d9bbac834dbab74520986c094c921932edab on super-user into 4a82ebf440ce52b7fca36a6dc3b9211ef33445ad on master.

karenc commented 7 years ago

@reedstrm

reedstrm commented 7 years ago

If the above works (do super first) then this is good to go, with a note in the template, maybe?

karenc commented 7 years ago

The only problem I see with this approach is it is a new connection, if what runs in the superuser() block depends on what happens before it, it's not going to be committed to the database yet (I think?). We might have a partially migrated database as well, because the superuser() stuff might succeed while the code after that might fail and not get committed.

But that's something to keep in mind when writing the migrations, implementing superuser() in db-migrator isn't a problem.

(From https://github.com/karenc/db-migrator/issues/38#issuecomment-322406117)

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 96.357% when pulling f7ad1f0c145fbde84db66f06abc9a32c9267984e on super-user into 4a82ebf440ce52b7fca36a6dc3b9211ef33445ad on master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 96.357% when pulling 1ff787d17e4e5720a757b15c764c706af2ca857c on super-user into 4a82ebf440ce52b7fca36a6dc3b9211ef33445ad on master.

karenc commented 6 years ago

CNX database privileges issues