So I'm having some issues with deadlocks when applying migrations to my Postgres database. The migrations in question are all CREATE TABLE (or CREATE UNIQUE, on these newly created tables).
They shouldn't be generating deadlocks, from what I can see.
It's not the same queries they are deadlocking with.
Has anyone else hit this?
jas02_ joined the channel
b00tstr4p has quit
Has hand-tweaking my migrations so they are all a single CreateModel (instead of having seperate AddColumn for the FKs) helped cause this?
mmxx_th has quit
FunkyBob
I read that as "hand-twerking" ... and thought it was some new craze
XHFHX has quit
schinckel
rofl
kyheo joined the channel
So my two planned approaches are to (a) just regenerate the migrations using "makemigrations", and (b) split the migration file into one per operation.
I think the former is nicer, so might try that first.
keimlink joined the channel
zamro joined the channel
keimlink_ has quit
CrowX- has quit
Darkhunter has quit
jas02_ has quit
goldfish joined the channel
renlo joined the channel
Bryson joined the channel
shangxiao joined the channel
So, it seems that my combining the AddFields was at least partly complicit.
Regenerating the migrations worked first time.
Darkhunter joined the channel
Lesson learned. Blog post likely.
FunkyBob
mmm?
Darkhunter has left the channel
schinckel
So I was making nice "clean" migrations by moving the AddFields that created FKs into the CreateModel operations.
Seems that maybe it's a deliberate decision to _not_ do that.
FunkyBob
ah
schinckel
I (mistakenly) thought that doing that would make the migrations apply faster and less chance of deadlock.
But it seems otherwise.
FunkyBob
MarkusH might know... or andrew
woltman joined the channel
schinckel
Yeah. It was MarkusH's blog posts that emboldened me to twerk (!!!) them. So I'll blame him ;)
mattmcc
Deferring FK constraints is convenient in most cases, but required in others (circular references)
schinckel
I thought it was just a side-effect of the CreateModel migration generation happening in alphabetical order.
mattmcc
I think it's more like they get to create them alphabetically because they know the constraints come later.. :)
schinckel
Perhaps.
mattmcc
I think South might've tried to create tables in the 'right' order and only defer when necessary, but it's been a while.
I might also be thinking of pre-South syncdb. :/
Electrometro joined the channel
schinckel
Hahaha.
fission6 joined the channel
winter98 joined the channel
mucco joined the channel
renlo joined the channel
fission6 has quit
mucco_ has quit
FancyCamel has quit
winter98 has quit
sol1x has quit
narfman0 joined the channel
zivester joined the channel
renlo joined the channel
donnex has quit
thinkt4nk joined the channel
zivester has quit
c17r joined the channel
MarkusH
schinckel: wait, what?
schinckel
I'm teasing, a little.
toc has quit
MarkusH
schinckel: no, srsly, details please
schinckel
I ran into an issue where altering migrations (to have fewer operations, by inlining the foreign key fields into the CreateModel statements) resulted in deadlocks.
ticketbot has quit
MarkusH
details
what models did you have
ticketbot joined the channel
what were your initial migrations and how were the once you optimized?
schinckel
I might have to PM you the differences in those.
Details will come.
Just in the middle of an email.
MarkusH
k
if you can drop me an example I'll take a look.
But will go to sleep now
schinckel
Yeah, will do.
Rialynn joined the channel
holler joined the channel
holler
hey, is there an easy way to enable plain text password in django admin for user?
as opposed to the hash form
FunkyBob
holler: no?
there is no way, since plain text passwords are never stored
schinckel
You really don't want that.
holler
FunkyBob: I have an admin user that needs to create some other user accounts but he cant enter a plain password for them
what do you suggest
FunkyBob
holler: whoever it is didn't read
Rialynn
Hi - I'm implementing Django's password reset and I want to customize the html for them but for some reason it seems that it always wants to use the default html. I tried to create a directory called admin inside of my templates directory and i have my app above the django.contrib.auth in INSTALLED_APPS in settings.py but it still only uses the default html. Any ideas?
FunkyBob
well, I've frequently created new users, and admin lets you enter plain passwords on creation
or also offers a password change form
schinckel
holler: You can _enter_ a password, but it's _never_ stored in plain text.
holler
hm
mrkent joined the channel
Koterpillar
Rialynn: so which template did you override?
holler
when I try, I set password "temp1234" and click save, on page refresh it still shows "password: temp1234"
dj 1.9
er 1.8
FunkyBob
holler: READ THE FINE PRINT... under that field it tells you you can't enter the password there
and then gives you a link to the password change form
holler
FunkyBob: there is no fine print!!! maybe its bc we created custom user
that's probably why
yeah we're missing that
Rialynn
@Koterpillar well ideally all of them but specifically i want to modify the html for password_reset_compete.html
amcorreia has quit
FunkyBob
"Raw passwords are not stored, so there is no way to see this user's password, but you can change the password using this form.