https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292012-03-24T10:05:13ZRedmineRedmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=369982012-03-24T10:05:13ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Resolution</strong> set to <i>Wont fix</i></li></ul><p>There's no models behind these tables, these are HABTM association tables. They're not supposed to have a primary key.<br /><a class="external" href="http://guides.rubyonrails.org/association_basics.html#the-has_and_belongs_to_many-association">http://guides.rubyonrails.org/association_basics.html#the-has_and_belongs_to_many-association</a></p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370152012-03-24T21:09:23ZM T
<ul></ul><p>I accept that the AR modelling paradigm may be not demand it. For me it's purely a pragmatic device just to get the db transfer done. Until whatever this bug in AR-postgres is fixed, the addition of the ID columns appears to be necessary for the purposes of doing the db transfer, after which it can be rolled back off the target. It really does make this type of transfer a lot easier to be able to use a generic script. Unless anyone has any other ideas on this.</p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370242012-03-25T19:14:48ZJean-Philippe Langjp_lang@yahoo.fr
<ul></ul><p>Milton Taylor wrote:</p>
<blockquote>
<p>I accept that the AR modelling paradigm may be not demand it.</p>
</blockquote>
<p>No, this is a requirement. Quoting the Rails guides:</p>
<blockquote>
<p>This table should be created without a primary key [...] That’s required for the association to work properly. If you observe any strange behavior in a has_and_belongs_to_many association like mangled models IDs, or exceptions about conflicting IDs chances are you forgot that bit.</p>
</blockquote>
<p><a class="external" href="http://guides.rubyonrails.org/association_basics.html#creating-join-tables-for-has_and_belongs_to_many-associations">http://guides.rubyonrails.org/association_basics.html#creating-join-tables-for-has_and_belongs_to_many-associations</a></p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370282012-03-25T20:49:25ZM T
<ul></ul><p>Cool, thanks for the pointers. Interestingly, the fault in the native pg adapter that was giving me the problem referred to above does not seem to exist in the corresponding AR jdbc adapter, but the latter seems to be seriously broken in other respects as I think you have already found. Am presently trying to shine some light on this.</p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370292012-03-25T23:38:37Zlaspariseanicko John
<ul><li><strong>Assignee</strong> set to <i>Jean-Baptiste Barth</i></li></ul><p>-</p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370332012-03-26T02:29:15Zkurtenbagabr billaa
<ul></ul><p>-</p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370352012-03-26T05:07:14ZToshi MARUYAMA
<ul><li><strong>Assignee</strong> deleted (<del><i>Jean-Baptiste Barth</i></del>)</li></ul> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370372012-03-26T05:50:04Zsheerinjerr aifseng
<ul><li><strong>Assignee</strong> set to <i>Anonymous</i></li></ul><p>-</p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370412012-03-26T05:52:57Zburgsgill aifseng
<ul></ul><p>-</p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370452012-03-26T06:59:44ZEtienne Massip
<ul><li><strong>Assignee</strong> deleted (<del><i>Anonymous</i></del>)</li></ul> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370482012-03-26T07:12:03Zraankelv John
<ul><li><strong>Assignee</strong> set to <i>M T</i></li></ul><p>-</p> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=370522012-03-26T07:46:14ZToshi MARUYAMA
<ul><li><strong>Assignee</strong> deleted (<del><i>M T</i></del>)</li></ul> Redmine - Defect #10537: Several tables do not have a primary key...indirectly causes problems with PostgreSQL in Rails 2.3https://www.redmine.org/issues/10537?journal_id=371792012-04-03T10:10:11ZM T
<ul><li><strong>File</strong> <a href="/attachments/7413">convert.rake</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/7413/convert.rake">convert.rake</a> added</li></ul><p>Just as a postscript for this issue, I have further altered the database transfer script to work around the original obstacle I encountered with transferring the HABTM tables. I have used this script to successfully move all redmine data from a mysql database to a postgresql database. It doesn't matter what version of redmine database you do this on - the script is introspective of the db, i.e. it does not use specific lists of tables nor does it rely on redmine application models. The only requirement is that the two schemas are both at the same rails migration level. As with all these things, make good backups first, and use at your own risk. YMMV.</p>
<p>This rake script really belongs in the wiki somewhere...perhaps one of the dev team might care to create a page for database migration (as in from one db type to another), discussing the various ways this can be accomplished.</p>