Defect #65
closed
Added by bajs bajs over 17 years ago.
Updated over 17 years ago.
Description
If the user registration fails for some reason (in my case because I created a lang/sv.yml but not the other translation
files needed) the user is only partially created. (I also got an error message)
When retrying (having removed lang/sv.yml) the user registration failed because both the username and the email address
were already in use, but the user did not show up in the user table in the admin interface.
Creating a user should be done atomically inside a transaction in order to fix this.
I repaired my database by manually deleting all references to the user from the database.
I realize that I screwed it up myself, but having foreign key constraints and using transactions really improves the
reliability of data stored in a database.
This with redmine 0.5.0 with a postgresql backend.
Hi,
I guess you got an error because register_sv.rhtml was missing.
But your database wasn't inconsistent. If you had selected
"Status: all" on users/list, you should have seen the
newly registered user.
Concerning translations, I've changed things a bit. Now (in current
source available in trunk), default templates (english)
are automatically used if translated ones are missing.
I agree with you about foreign key constraints, but:
- they're not natively supported by rails
- they're unusable when working with polymorphic associations.
Ah, I completely missed that dropbox. Thanks.
Too bad about transactions. But shouldn't the database use
foreign keys constraints?
Too bad about transactions.
Transactions are OK. For example, user creation is done inside
a transaction.
But shouldn't the database use foreign keys constraints?
As I said:
- they're not natively supported by rails
- they're unusable when working with polymorphic associations.
Ooops. I misread.
Can't foreign key constraints be implemented by just
modifying the database?
Example with PostgreSQL:
ALTER TABLE issues ADD CONSTRAINT
issues_project_id_contraint FOREIGN KEY (project_id)
REFERENCES projects (id) MATCH FULL;
Migrations have to be database independent.
There's a rails plugin for managing constraints, but I prefer
to keep migrations independent from any plugin.
Also available in: Atom
PDF