Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7085 (assigned defect)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Honor primary_key_prefix_type in schema dumper and migrations

Reported by: ben Assigned to: nzkoz (accepted)
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: migrations schema dumper primary_key_prefix_type
Cc:

Description

When dumping a schema or running a migration, the setting of ActiveRecord::Base.primary_key_prefix_type should not be ignored. Currently, both of these bits of code always assume the primary key field is called 'id', instead of correctly determining whether the primary key should be 'id', 'tablenameid', or 'tablename_id'.

This patch fixes both schema_dumper.rb and schema_statements.rb to dump and create tables with the correct primary key based on the value of ActiveRecord::Base.primary_key_prefix_type.

Also included is a patch to inflector.rb to help generate the primary key field name.

Attachments

schema.diff (7.5 kB) - added by ben on 01/16/07 16:43:11.
schema_dumper.diff (5.1 kB) - added by ben on 01/19/07 23:12:55.
Same as previous patch but without the migration changes

Change History

01/16/07 16:43:11 changed by ben

  • attachment schema.diff added.

01/18/07 08:30:55 changed by jarkko

  • keywords set to migrations schema dumper.

01/19/07 23:12:55 changed by ben

  • attachment schema_dumper.diff added.

Same as previous patch but without the migration changes

01/22/07 02:18:36 changed by nzkoz

  • owner changed from core to nzkoz.
  • status changed from new to assigned.

01/25/07 03:10:29 changed by ben

  • keywords changed from migrations schema dumper to migrations schema dumper primary_key_prefix_type.

See #7367 for primary_key_prefix_type fixes for the model generator.