]> git.openstreetmap.org Git - rails.git/commitdiff
Primary keys can't have names so don't pretend otherwise.
authorTom Hughes <tom@compton.nu>
Sun, 24 Jun 2007 11:38:35 +0000 (11:38 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 24 Jun 2007 11:38:35 +0000 (11:38 +0000)
db/migrate/001_create_osm_db.rb
lib/migrate.rb

index e5840b380e98081b7d09e6624a1e8542312701e4..3a98d6dc1ecbf69052e31d5ad88e8dc6c898b379 100644 (file)
@@ -62,7 +62,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "visible",   :boolean
     end
 
-    add_primary_key "current_ways", ["id"], :name => "current_ways_id_idx", :unique => true
+    add_primary_key "current_ways", ["id"]
 
     change_column "current_ways", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
 
@@ -75,7 +75,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "updated_at", :datetime
     end
 
-    add_primary_key "diary_entries", ["id"], :name => "diary_entries_id_idx", :unique => true
+    add_primary_key "diary_entries", ["id"]
 
     change_column "diary_entries", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
 
@@ -85,7 +85,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "friend_user_id", :bigint,  :limit => 20, :null => false
     end
 
-    add_primary_key "friends", ["id"], :name => "friends_id_idx", :unique => true
+    add_primary_key "friends", ["id"]
     add_index "friends", ["friend_user_id"], :name => "user_id_idx"
 
     change_column "friends", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
@@ -110,7 +110,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "id",     :integer, :limit => 20, :null => false
     end
 
-    add_primary_key "gpx_file_tags", ["id"], :name => "gpx_file_tags_id_idx", :unique => true
+    add_primary_key "gpx_file_tags", ["id"]
     add_index "gpx_file_tags", ["gpx_id"], :name => "gpx_file_tags_gpxid_idx"
 
     change_column "gpx_file_tags", "id", :integer, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
@@ -129,7 +129,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "inserted",    :boolean
     end
 
-    add_primary_key "gpx_files", ["id"], :name => "gpx_files_id_idx", :unique => true
+    add_primary_key "gpx_files", ["id"]
     add_index "gpx_files", ["timestamp"], :name => "gpx_files_timestamp_idx"
     add_index "gpx_files", ["visible", "public"], :name => "gpx_files_visible_public_idx"
 
@@ -153,7 +153,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "to_user_id",        :bigint,   :limit => 20,                    :null => false
     end
 
-    add_primary_key "messages", ["id"], :name => "messages_id_idx", :unique => true
+    add_primary_key "messages", ["id"]
     add_index "messages", ["from_display_name"], :name => "from_name_idx"
 
     change_column "messages", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
@@ -164,7 +164,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "timestamp", :datetime
     end
 
-    add_primary_key "meta_areas", ["id"], :name => "meta_areas_id_idx", :unique => true
+    add_primary_key "meta_areas", ["id"]
 
     change_column "meta_areas", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
 
@@ -214,7 +214,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "home_zoom",     :integer,  :limit => 2,  :default => 3
     end
 
-    add_primary_key "users", ["id"], :name => "users_id_idx", :unique => true
+    add_primary_key "users", ["id"]
     add_index "users", ["email"], :name => "users_email_idx"
     add_index "users", ["display_name"], :name => "users_display_name_idx"
 
@@ -227,7 +227,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "sequence_id", :bigint,  :limit => 11,                :null => false
     end
 
-    add_primary_key "way_segments", ["id", "version", "sequence_id"], :name => "way_segments_id_version_sequence_idx", :unique => true
+    add_primary_key "way_segments", ["id", "version", "sequence_id"]
 
     change_column "way_segments", "sequence_id", :bigint, :limit => 11, :null => false, :options => "AUTO_INCREMENT"
 
@@ -248,7 +248,7 @@ class CreateOsmDb < ActiveRecord::Migration
       t.column "visible",   :boolean,                :default => true
     end
 
-    add_primary_key "ways", ["id", "version"], :name => "ways_primary_idx", :unique => true
+    add_primary_key "ways", ["id", "version"]
     add_index "ways", ["id"], :name => "ways_id_version_idx"
 
     change_column "ways", "version", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
index 737ff57ece8f767efaf3310dba0d3065b07ccc71..4cbabd6c08c225ef77b2f567cbf8e5cd17e6e019 100644 (file)
@@ -2,10 +2,9 @@ module ActiveRecord
   module ConnectionAdapters
     module SchemaStatements
       def add_primary_key(table_name, column_name, options = {})
-        index_name = options[:name]
         column_names = Array(column_name)
         quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ")
-        execute "ALTER TABLE #{table_name} ADD PRIMARY KEY #{quote_column_name(index_name)} (#{quoted_column_names})"
+        execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{quoted_column_names})"
       end
 
       alias_method :old_add_column_options!, :add_column_options!