]> git.openstreetmap.org Git - rails.git/commitdiff
- Add missing null constraints.
authorTom Hughes <tom@compton.nu>
Wed, 23 Jan 2008 19:25:37 +0000 (19:25 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 23 Jan 2008 19:25:37 +0000 (19:25 +0000)
- Drop pointless index on current_node_tags and order primary key correctly.
- Make version column of node history table auto increment.

db/migrate/011_create_node_tags.rb
db/migrate/012_create_old_node_tags.rb
db/migrate/013_populate_node_tags_and_remove.rb
db/migrate/014_create_temp_old_nodes.rb

index e0e791404901d9a54ddda9febf243f17c212e153..6f84043eef4149c78ccef5d10ccd8c34aa957f92 100644 (file)
@@ -1,18 +1,15 @@
 class CreateNodeTags < ActiveRecord::Migration
   def self.up
     create_table "current_node_tags", myisam_table do |t|
-      t.column "id", :bigint, :limit => 64
-      t.column "sequence_id", :bigint, :limit => 11
-      t.column "k",  :string,                :default => "", :null => false
-      t.column "v",  :string,                :default => "", :null => false
+      t.column "id",          :bigint, :limit => 64                 :null => false
+      t.column "sequence_id", :bigint, :limit => 11                 :null => false
+      t.column "k",           :string,              :default => "", :null => false
+      t.column "v",           :string,              :default => "", :null => false
     end
 
-    add_index "current_node_tags", ["id"], :name => "current_node_tags_id_idx"
-    add_primary_key "current_node_tags", ["sequence_id", "id"]
+    add_primary_key "current_node_tags", ["id", "sequence_id"]
        
     execute "CREATE FULLTEXT INDEX `current_node_tags_v_idx` ON `current_node_tags` (`v`)"
-
-
   end
 
   def self.down
index 329636d45aea0fca09225d7dd482af5d25ebee6e..aeb5abd4c959da23962449d6110da39a69664b74 100644 (file)
@@ -1,16 +1,14 @@
 class CreateOldNodeTags < ActiveRecord::Migration
   def self.up
     create_table "node_tags", myisam_table do |t|
-      t.column "id",      :bigint,  :limit => 64, :default => 0, :null => false
-      t.column "sequence_id", :bigint, :limit => 11
-      t.column "k",       :string
-      t.column "v",       :string
-      t.column "version", :bigint,  :limit => 20
+      t.column "id",          :bigint, :limit => 64, :default => 0, :null => false
+      t.column "version",     :bigint, :limit => 20,                :null => false
+      t.column "sequence_id", :bigint, :limit => 11,                :null => false
+      t.column "k",           :string,                              :null => false
+      t.column "v",           :string,                              :null => false
     end
 
-    add_index "node_tags", ["version"], :name => "node_tags_id_version_idx"
     add_primary_key "node_tags", ["id", "version", "sequence_id"]
-
   end
 
   def self.down
index f3642316ee64bf0f74e0fa1a4c1b5f729e70caa1..c7f0ad73bb0bd231bc918203421ffd4b1dde74d0 100644 (file)
@@ -1,6 +1,5 @@
 class PopulateNodeTagsAndRemove < ActiveRecord::Migration
   def self.up
-
     #rake import 
     remove_column :nodes, :tags
     remove_column :current_nodes, :tags
index 7b768425ce30df6e98de250823f2b33a9f80a151..60edb8406efe3770fae0de3d318d12fa0dc6c474 100644 (file)
@@ -1,21 +1,21 @@
 class CreateTempOldNodes < ActiveRecord::Migration
   def self.up
-
     create_table "temp_nodes", myisam_table do |t|
-      t.column "id",        :bigint,  :limit => 64
-      t.column "version",    :bigint, :limit => 20, :default => 0, :null => false
-      t.column "latitude",  :double
-      t.column "longitude", :double
-      t.column "user_id",   :bigint,  :limit => 20
-      t.column "visible",   :boolean
-      t.column "timestamp", :datetime
-      t.column "tile", :integer, :null => false
+      t.column "id",        :bigint,  :limit => 64, :null => false
+      t.column "version",   :bigint,  :limit => 20, :null => false
+      t.column "latitude",  :double,                :null => false
+      t.column "longitude", :double,                :null => false
+      t.column "user_id",   :bigint,  :limit => 20, :null => false
+      t.column "visible",   :boolean,               :null => false
+      t.column "timestamp", :datetime,              :null => false
+      t.column "tile",      :integer,               :null => false
     end
 
-  add_primary_key "temp_nodes", ["id", "version"] 
-  add_index "temp_nodes", ["timestamp"], :name => "temp_nodes_timestamp_idx"
-  add_index "temp_nodes", ["tile"], :name => "temp_nodes_tile_idx"
+    add_primary_key "temp_nodes", ["id", "version"] 
+    add_index "temp_nodes", ["timestamp"], :name => "temp_nodes_timestamp_idx"
+    add_index "temp_nodes", ["tile"], :name => "temp_nodes_tile_idx"
 
+    change_column "temp_nodes", "version", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
   end
 
   def self.down