source 'https://rubygems.org'
# Require rails
-gem 'rails', '4.1.9'
+gem 'rails', '4.2.0'
# Require things which have moved to gems in ruby 1.9
gem 'bigdecimal', "~> 1.1.0", :platforms => :ruby_19
gem 'pg'
# Use SCSS for stylesheets
-gem 'sass-rails', '~> 4.0.3'
+gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
-gem 'coffee-rails', '~> 4.0.0'
+gem 'coffee-rails', '~> 4.1.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
-# gem 'jbuilder', '~> 1.2'
+# gem 'jbuilder', '~> 2.0'
gem 'jsonify-rails'
# Use R2 for RTL conversion
gem 'oauth-plugin', '>= 0.5.1'
gem 'open_id_authentication', '>= 1.1.0'
gem 'validates_email_format_of', '>= 1.5.1'
-gem 'composite_primary_keys', '~> 7.0.11'
+gem 'composite_primary_keys', '~> 8.0.0'
gem 'http_accept_language', '~> 2.0.0'
gem 'paperclip', '~> 4.0'
gem 'deadlock_retry', '>= 1.2.0'
remote: https://rubygems.org/
specs:
SystemTimer (1.2.3)
- actionmailer (4.1.9)
- actionpack (= 4.1.9)
- actionview (= 4.1.9)
+ actionmailer (4.2.0)
+ actionpack (= 4.2.0)
+ actionview (= 4.2.0)
+ activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
- actionpack (4.1.9)
- actionview (= 4.1.9)
- activesupport (= 4.1.9)
- rack (~> 1.5.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.0)
+ actionview (= 4.2.0)
+ activesupport (= 4.2.0)
+ rack (~> 1.6.0)
rack-test (~> 0.6.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionpack-page_caching (1.0.2)
actionpack (>= 4.0.0, < 5)
- actionview (4.1.9)
- activesupport (= 4.1.9)
+ actionview (4.2.0)
+ activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
- activemodel (4.1.9)
- activesupport (= 4.1.9)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
+ activejob (4.2.0)
+ activesupport (= 4.2.0)
+ globalid (>= 0.3.0)
+ activemodel (4.2.0)
+ activesupport (= 4.2.0)
builder (~> 3.1)
- activerecord (4.1.9)
- activemodel (= 4.1.9)
- activesupport (= 4.1.9)
- arel (~> 5.0.0)
- activesupport (4.1.9)
- i18n (~> 0.6, >= 0.6.9)
+ activerecord (4.2.0)
+ activemodel (= 4.2.0)
+ activesupport (= 4.2.0)
+ arel (~> 6.0)
+ activesupport (4.2.0)
+ i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
- thread_safe (~> 0.1)
+ thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
- arel (5.0.1.20140414130214)
+ arel (6.0.0)
autoprefixer-rails (4.0.2.2)
execjs
bigdecimal (1.1.0)
cliver (0.3.2)
cocaine (0.5.5)
climate_control (>= 0.0.3, < 1.0)
- coffee-rails (4.0.1)
+ coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
execjs
coffee-script-source (1.8.0)
colorize (0.7.5)
- composite_primary_keys (7.0.12)
- activerecord (~> 4.1.7)
+ composite_primary_keys (8.0.0)
+ activerecord (~> 4.2.0)
crass (1.0.1)
dalli (2.7.2)
deadlock_retry (1.2.0)
execjs (2.2.2)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
+ globalid (0.3.0)
+ activesupport (>= 4.1.0)
hike (1.2.3)
htmlentities (4.3.3)
http_accept_language (2.0.2)
httpclient (2.6.0.1)
i18n (0.7.0)
iconv (0.1)
- jquery-rails (3.1.2)
- railties (>= 3.0, < 5.0)
+ jquery-rails (4.0.3)
+ rails-dom-testing (~> 1.0)
+ railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
- json (1.8.1)
+ json (1.8.2)
jsonify (0.3.1)
multi_json (~> 1.0)
jsonify-rails (0.3.2)
colorize
railties (>= 3.1, < 5)
sprockets
- libxml-ruby (2.7.0)
+ libxml-ruby (2.8.0)
+ loofah (2.0.1)
+ nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.4.3)
mini_portile (0.6.2)
- minitest (5.5.0)
+ minitest (5.5.1)
multi_json (1.10.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
- psych (2.0.8)
+ psych (2.0.9)
r2 (0.2.5)
- rack (1.5.2)
+ rack (1.6.0)
rack-cors (0.3.1)
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
- rack-test (0.6.2)
+ rack-test (0.6.3)
rack (>= 1.0)
- rails (4.1.9)
- actionmailer (= 4.1.9)
- actionpack (= 4.1.9)
- actionview (= 4.1.9)
- activemodel (= 4.1.9)
- activerecord (= 4.1.9)
- activesupport (= 4.1.9)
+ rails (4.2.0)
+ actionmailer (= 4.2.0)
+ actionpack (= 4.2.0)
+ actionview (= 4.2.0)
+ activejob (= 4.2.0)
+ activemodel (= 4.2.0)
+ activerecord (= 4.2.0)
+ activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.1.9)
- sprockets-rails (~> 2.0)
+ railties (= 4.2.0)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.5)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6.0)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.1)
+ loofah (~> 2.0)
rails-i18n (4.0.3)
i18n (~> 0.6)
railties (~> 4.0)
- railties (4.1.9)
- actionpack (= 4.1.9)
- activesupport (= 4.1.9)
+ railties (4.2.0)
+ actionpack (= 4.2.0)
+ activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
crass (~> 1.0.1)
nokogiri (>= 1.4.4)
nokogumbo (= 1.2.0)
- sass (3.2.19)
- sass-rails (4.0.5)
+ sass (3.4.9)
+ sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
- sass (~> 3.2.2)
- sprockets (~> 2.8, < 3.0)
- sprockets-rails (~> 2.0)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (~> 1.1)
soap4r-ruby1.9 (2.0.5)
sprockets (2.12.3)
hike (~> 1.2)
timecop (0.7.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
- uglifier (2.6.1)
+ uglifier (2.7.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
validates_email_format_of (1.6.1)
actionpack-page_caching
autoprefixer-rails
bigdecimal (~> 1.1.0)
- coffee-rails (~> 4.0.0)
- composite_primary_keys (~> 7.0.11)
+ coffee-rails (~> 4.1.0)
+ composite_primary_keys (~> 8.0.0)
dalli
deadlock_retry (>= 1.2.0)
dynamic_form
psych
r2
rack-cors
- rails (= 4.1.9)
+ rails (= 4.2.0)
rails-i18n (~> 4.0.0)
redcarpet
rinku (>= 1.2.2)
ruby-openid (>= 2.2.0)
sanitize
- sass-rails (~> 4.0.3)
+ sass-rails (~> 5.0)
soap4r-ruby1.9
timecop
uglifier (>= 1.3.0)
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
-require 'rake'
OpenStreetMap::Application.load_tasks
# Notify current subscribers of the new comment
changeset.subscribers.each do |user|
if @user != user
- Notifier.changeset_comment_notification(comment, user).deliver
+ Notifier.changeset_comment_notification(comment, user).deliver_now
end
end
@diary_comment.user = @user
if @diary_comment.save
if @diary_comment.user != @entry.user
- Notifier.diary_comment_notification(@diary_comment).deliver
+ Notifier.diary_comment_notification(@diary_comment).deliver_now
end
redirect_to :controller => 'diary_entry', :action => 'view', :display_name => @entry.user.display_name, :id => @entry.id
if @message.save
flash[:notice] = t 'message.new.message_sent'
- Notifier.message_notification(@message).deliver
+ Notifier.message_notification(@message).deliver_now
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
end
end
note.comments.map { |c| c.author }.uniq.each do |user|
if notify and user and user != @user
- Notifier.note_comment_notification(comment, user).deliver
+ Notifier.note_comment_notification(comment, user).deliver_now
end
end
end
successful_login(@user)
else
session[:token] = @user.tokens.create.token
- Notifier.signup_confirm(@user, @user.tokens.create(:referer => referer)).deliver
+ Notifier.signup_confirm(@user, @user.tokens.create(:referer => referer)).deliver_now
redirect_to :action => 'confirm', :display_name => @user.display_name
end
else
if user
token = user.tokens.create
- Notifier.lost_password(user, token).deliver
+ Notifier.lost_password(user, token).deliver_now
flash[:notice] = t 'user.lost_password.notice email on way'
redirect_to :action => 'login'
else
def confirm_resend
if user = User.find_by_display_name(params[:display_name])
- Notifier.signup_confirm(user, user.tokens.create).deliver
+ Notifier.signup_confirm(user, user.tokens.create).deliver_now
flash[:notice] = t 'user.confirm_resend.success', :email => user.email
else
flash[:notice] = t 'user.confirm_resend.failure', :name => params[:display_name]
unless @user.is_friends_with?(@new_friend)
if friend.save
flash[:notice] = t 'user.make_friend.success', :name => @new_friend.display_name
- Notifier.friend_notification(friend).deliver
+ Notifier.friend_notification(friend).deliver_now
else
friend.add_error(t('user.make_friend.failed', :name => @new_friend.display_name))
end
flash.now[:notice] = t 'user.account.flash update success confirm needed'
begin
- Notifier.email_confirm(user, user.tokens.create).deliver
+ Notifier.email_confirm(user, user.tokens.create).deliver_now
rescue
# Ignore errors sending email
end
@user.errors.set(:email, [])
end
- user.reset_email!
+ user.restore_email!
end
end
end
validates_presence_of :body
validates_associated :diary_entry
- after_initialize :set_defaults
after_save :spam_check
def body
private
- def set_defaults
- self.body_format = "markdown" unless self.attribute_present?(:body_format)
- end
-
def spam_check
user.spam_check
end
:greater_than_or_equal_to => -180, :less_than_or_equal_to => 180
validates_associated :language
- after_initialize :set_defaults
after_save :spam_check
def body
private
- def set_defaults
- self.body_format = "markdown" unless self.attribute_present?(:body_format)
- end
-
def spam_check
user.spam_check
end
validates_inclusion_of :message_read, :in => [ true, false ]
validates_as_utf8 :title
- after_initialize :set_defaults
-
def self.from_mail(mail, from, to)
if mail.multipart?
if mail.text_part
md5 << body
md5.hexdigest
end
-
-private
-
- def set_defaults
- self.body_format = "markdown" unless self.attribute_present?(:body_format)
- end
end
def save_with_dependencies!
save!
- #not sure whats going on here
- clear_aggregation_cache
- clear_association_cache
- #ok from here
- @attributes.update(OldNode.where(:node_id => self.node_id, :timestamp => self.timestamp, :version => self.version).first.instance_variable_get('@attributes'))
self.tags.each do |k,v|
tag = OldNodeTag.new
end
def save_with_dependencies!
-
- # see comment in old_way.rb ;-)
save!
- clear_aggregation_cache
- clear_association_cache
- @attributes.update(OldRelation.where(:relation_id => self.relation_id, :timestamp => self.timestamp).order("version DESC").first.instance_variable_get('@attributes'))
-
- # ok, you can touch from here on
self.tags.each do |k,v|
tag = OldRelationTag.new
end
def save_with_dependencies!
-
- # dont touch this unless you really have figured out why it's called
- # (Rails doesn't deal well with the old ways table (called 'ways') because
- # it doesn't have a unique key. It knows how to insert and auto_increment
- # id and get it back but we have that and we want to get the 'version' back
- # we could add another column but thats a lot of data. No, set_primary_key
- # doesn't work either.
save!
- clear_aggregation_cache
- clear_association_cache
- @attributes.update(OldWay.where(:way_id => self.way_id, :timestamp => self.timestamp).order("version DESC").first.instance_variable_get('@attributes'))
-
- # ok, you can touch from here on
self.tags.each do |k,v|
tag = OldWayTag.new
has_many :old_ways
has_many :old_relations
- after_initialize :set_defaults
-
# this method overrides the AR default to provide the rich
# text object for the description field.
def description
RichText.new(read_attribute(:description_format), read_attribute(:description))
end
-
- private
-
- # set the default format to be markdown, in the absence of
- # any other setting.
- def set_defaults
- self.description_format = "markdown" unless self.attribute_present?(:description_format)
- end
end
def set_defaults
self.creation_time = Time.now.getutc unless self.attribute_present?(:creation_time)
- self.description_format = "markdown" unless self.attribute_present?(:description_format)
end
def encrypt_password
belongs_to :user, :class_name => "User", :foreign_key => :user_id
belongs_to :creator, :class_name => "User", :foreign_key => :creator_id
belongs_to :revoker, :class_name => "User", :foreign_key => :revoker_id
-
- after_initialize :set_defaults
PERIODS = USER_BLOCK_PERIODS
private
- ##
- # set default values for new records.
- def set_defaults
- self.reason_format = "markdown" unless self.attribute_present?(:reason_format)
- end
-
##
# validate that only moderators are allowed to change the
# block. this should be caught and dealt with in the controller,
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
+
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib)
-# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' # Set up gems listed in the Gemfile.
# number of complex assets.
config.assets.debug = true
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
- # Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_assets = false
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs.
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
config.assets.digest = true
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
+
# Specifies the header that your server uses for sending files.
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
- # Set to :debug to see everything in the log.
- config.log_level = :info
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
config.action_controller.page_cache_directory = Rails.public_path
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # `config.assets.precompile` has moved to config/initializers/assets.rb
+ # config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found).
+ # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
- # Disable automatic flushing of the log to improve performance.
- # config.autoflush_log = false
-
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
- # Configure static asset server for tests with Cache-Control for performance.
- config.serve_static_assets = true
+ # Configure static file server for tests with Cache-Control for performance.
+ config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
+
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Rails.application.config.assets.precompile += %w( index.js browse.js welcome.js fixthemap.js )
# Be sure to restart your server when you modify this file.
-Rails.application.config.action_dispatch.cookies_serializer = :json
\ No newline at end of file
+Rails.application.config.action_dispatch.cookies_serializer = :json
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
Mime::Type.register "application/x-amf", :amf
Mime::Type.register "application/gpx+xml", :gpx
+++ /dev/null
-if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
- module ActiveRecord
- module ConnectionAdapters
- class PostgreSQLAdapter
- def initialize_type_map_with_enums(type_map)
- OID.alias_type "format_enum", "text"
- OID.alias_type "gpx_visibility_enum", "text"
- OID.alias_type "note_status_enum", "text"
- OID.alias_type "note_event_enum", "text"
- OID.alias_type "nwr_enum", "text"
- OID.alias_type "user_role_enum", "text"
- OID.alias_type "user_status_enum", "text"
-
- initialize_type_map_without_enums(type_map)
- end
-
- alias_method_chain :initialize_type_map, :enums
- end
-
- class PostgreSQLColumn
- def simplified_type_with_enum(field_type)
- case field_type
- when /_enum$/
- :string
- else
- simplified_type_without_enum(field_type)
- end
- end
-
- alias_method_chain :simplified_type, :enum
- end
- end
- end
-end
class CreateOsmDb < ActiveRecord::Migration
def self.up
- create_table "current_nodes", innodb_table do |t|
- t.column "id", :bigint, :limit => 64, :null => false
- t.column "latitude", :double
- t.column "longitude", :double
- t.column "user_id", :bigint, :limit => 20
+ create_table "current_nodes", :id => false do |t|
+ t.column "id", :bigint, :null => false
+ t.column "latitude", :float, :limit => 53
+ t.column "longitude", :float, :limit => 53
+ t.column "user_id", :bigint
t.column "visible", :boolean
- t.column "tags", :text, :default => "", :null => false
+ t.column "tags", :text, :default => "", :null => false
t.column "timestamp", :datetime
end
add_index "current_nodes", ["latitude", "longitude"], :name => "current_nodes_lat_lon_idx"
add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
- change_column :current_nodes, :id, :bigint_auto_64
-
- create_table "current_segments", innodb_table do |t|
- t.column "id", :bigint, :limit => 64, :null => false
- t.column "node_a", :bigint, :limit => 64
- t.column "node_b", :bigint, :limit => 64
- t.column "user_id", :bigint, :limit => 20
+ create_table "current_segments", :id => false do |t|
+ t.column "id", :bigint, :null => false
+ t.column "node_a", :bigint
+ t.column "node_b", :bigint
+ t.column "user_id", :bigint
t.column "visible", :boolean
- t.column "tags", :text, :default => "", :null => false
+ t.column "tags", :text, :default => "", :null => false
t.column "timestamp", :datetime
end
add_index "current_segments", ["node_a"], :name => "current_segments_a_idx"
add_index "current_segments", ["node_b"], :name => "current_segments_b_idx"
- change_column :current_segments, :id, :bigint_auto_64
-
- create_table "current_way_segments", innodb_table do |t|
- t.column "id", :bigint, :limit => 64
- t.column "segment_id", :bigint, :limit => 11
- t.column "sequence_id", :bigint, :limit => 11
+ create_table "current_way_segments", :id => false do |t|
+ t.column "id", :bigint
+ t.column "segment_id", :bigint
+ t.column "sequence_id", :bigint
end
add_index "current_way_segments", ["segment_id"], :name => "current_way_segments_seg_idx"
add_index "current_way_segments", ["id"], :name => "current_way_segments_id_idx"
- create_table "current_way_tags", myisam_table do |t|
- t.column "id", :bigint, :limit => 64
- t.column "k", :string, :default => "", :null => false
- t.column "v", :string, :default => "", :null => false
+ create_table "current_way_tags", :id => false do |t|
+ t.column "id", :bigint
+ t.column "k", :string, :default => "", :null => false
+ t.column "v", :string, :default => "", :null => false
end
add_index "current_way_tags", ["id"], :name => "current_way_tags_id_idx"
- add_fulltext_index "current_way_tags", "v"
+ add_index "current_way_tags", "v", :name => "current_way_tags_v_idx"
- create_table "current_ways", myisam_table do |t|
- t.column "id", :bigint_pk_64, :null => false
- t.column "user_id", :bigint, :limit => 20
+ create_table "current_ways", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint
t.column "timestamp", :datetime
t.column "visible", :boolean
end
- create_table "diary_entries", myisam_table do |t|
- t.column "id", :bigint_pk, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
+ create_table "diary_entries", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint, :null => false
t.column "title", :string
t.column "body", :text
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
- create_table "friends", myisam_table do |t|
- t.column "id", :bigint_pk, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "friend_user_id", :bigint, :limit => 20, :null => false
+ create_table "friends", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "friend_user_id", :bigint, :null => false
end
add_index "friends", ["friend_user_id"], :name => "user_id_idx"
- create_table "gps_points", myisam_table do |t|
+ create_table "gps_points", :id => false do |t|
t.column "altitude", :float
t.column "user_id", :integer
t.column "trackid", :integer
add_index "gps_points", ["user_id"], :name => "points_uid_idx"
add_index "gps_points", ["gpx_id"], :name => "points_gpxid_idx"
- create_table "gpx_file_tags", myisam_table do |t|
- t.column "gpx_id", :bigint, :limit => 64, :default => 0, :null => false
+ create_table "gpx_file_tags", :id => false do |t|
+ t.column "gpx_id", :bigint, :default => 0, :null => false
t.column "tag", :string
- t.column "id", :bigint_pk, :null => false
+ t.column "id", :bigserial, :primary_key => true, :null => false
end
add_index "gpx_file_tags", ["gpx_id"], :name => "gpx_file_tags_gpxid_idx"
- create_table "gpx_files", myisam_table do |t|
- t.column "id", :bigint_pk_64, :null => false
- t.column "user_id", :bigint, :limit => 20
- t.column "visible", :boolean, :default => true, :null => false
- t.column "name", :string, :default => "", :null => false
- t.column "size", :bigint, :limit => 20
- t.column "latitude", :double
- t.column "longitude", :double
+ create_table "gpx_files", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint
+ t.column "visible", :boolean, :default => true, :null => false
+ t.column "name", :string, :default => "", :null => false
+ t.column "size", :bigint
+ t.column "latitude", :float, :limit => 53
+ t.column "longitude", :float, :limit => 53
t.column "timestamp", :datetime
- t.column "public", :boolean, :default => true, :null => false
- t.column "description", :string, :default => ""
+ t.column "public", :boolean, :default => true, :null => false
+ t.column "description", :string, :default => ""
t.column "inserted", :boolean
end
add_index "gpx_files", ["timestamp"], :name => "gpx_files_timestamp_idx"
add_index "gpx_files", ["visible", "public"], :name => "gpx_files_visible_public_idx"
- create_table "gpx_pending_files", myisam_table do |t|
+ create_table "gpx_pending_files", :id => false do |t|
t.column "originalname", :string
t.column "tmpname", :string
- t.column "user_id", :bigint, :limit => 20
+ t.column "user_id", :bigint
end
- create_table "messages", myisam_table do |t|
- t.column "id", :bigint_pk, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "from_user_id", :bigint, :limit => 20, :null => false
- t.column "from_display_name", :string, :default => ""
+ create_table "messages", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "from_user_id", :bigint, :null => false
+ t.column "from_display_name", :string, :default => ""
t.column "title", :string
t.column "body", :text
t.column "sent_on", :datetime
- t.column "message_read", :boolean, :default => false
- t.column "to_user_id", :bigint, :limit => 20, :null => false
+ t.column "message_read", :boolean, :default => false
+ t.column "to_user_id", :bigint, :null => false
end
add_index "messages", ["from_display_name"], :name => "from_name_idx"
- create_table "meta_areas", myisam_table do |t|
- t.column "id", :bigint_pk_64, :null => false
- t.column "user_id", :bigint, :limit => 20
+ create_table "meta_areas", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint
t.column "timestamp", :datetime
end
- create_table "nodes", myisam_table do |t|
- t.column "id", :bigint, :limit => 64
- t.column "latitude", :double
- t.column "longitude", :double
- t.column "user_id", :bigint, :limit => 20
+ create_table "nodes", :id => false do |t|
+ t.column "id", :bigint
+ t.column "latitude", :float, :limit => 53
+ t.column "longitude", :float, :limit => 53
+ t.column "user_id", :bigint
t.column "visible", :boolean
- t.column "tags", :text, :default => "", :null => false
+ t.column "tags", :text, :default => "", :null => false
t.column "timestamp", :datetime
end
add_index "nodes", ["id"], :name => "nodes_uid_idx"
add_index "nodes", ["latitude", "longitude"], :name => "nodes_latlon_idx"
- create_table "segments", myisam_table do |t|
- t.column "id", :bigint, :limit => 64
- t.column "node_a", :bigint, :limit => 64
- t.column "node_b", :bigint, :limit => 64
- t.column "user_id", :bigint, :limit => 20
+ create_table "segments", :id => false do |t|
+ t.column "id", :bigint
+ t.column "node_a", :bigint
+ t.column "node_b", :bigint
+ t.column "user_id", :bigint
t.column "visible", :boolean
- t.column "tags", :text, :default => "", :null => false
+ t.column "tags", :text, :default => "", :null => false
t.column "timestamp", :datetime
end
add_index "segments", ["node_b"], :name => "street_segments_nodeb_idx"
add_index "segments", ["id"], :name => "street_segment_uid_idx"
- create_table "users", innodb_table do |t|
+ create_table "users", :id => false do |t|
t.column "email", :string
- t.column "id", :bigint_pk, :null => false
+ t.column "id", :bigserial, :primary_key => true, :null => false
t.column "token", :string
- t.column "active", :integer, :default => 0, :null => false
+ t.column "active", :integer, :default => 0, :null => false
t.column "pass_crypt", :string
t.column "creation_time", :datetime
t.column "timeout", :datetime
- t.column "display_name", :string, :default => ""
+ t.column "display_name", :string, :default => ""
t.column "preferences", :text
- t.column "data_public", :boolean, :default => false
- t.column "description", :text, :default => "", :null => false
- t.column "home_lat", :double, :default => 1
- t.column "home_lon", :double, :default => 1
- t.column "within_lon", :double
- t.column "within_lat", :double
- t.column "home_zoom", :integer, :limit => 2, :default => 3
+ t.column "data_public", :boolean, :default => false
+ t.column "description", :text, :default => "", :null => false
+ t.column "home_lat", :float, :limit => 53, :default => 1
+ t.column "home_lon", :float, :limit => 53, :default => 1
+ t.column "within_lon", :float, :limit => 53
+ t.column "within_lat", :float, :limit => 53
+ t.column "home_zoom", :integer, :limit => 2, :default => 3
end
add_index "users", ["email"], :name => "users_email_idx"
add_index "users", ["display_name"], :name => "users_display_name_idx"
- create_table "way_segments", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :default => 0, :null => false
+ create_table "way_segments", :id => false do |t|
+ t.column "id", :bigint, :default => 0, :null => false
t.column "segment_id", :integer
- t.column "version", :bigint, :limit => 20, :default => 0, :null => false
- t.column "sequence_id", :bigint, :limit => 11, :null => false
+ t.column "version", :bigint, :default => 0, :null => false
+ t.column "sequence_id", :bigint, :null => false
end
add_primary_key "way_segments", ["id", "version", "sequence_id"]
- change_column "way_segments", "sequence_id", :bigint_auto_11
-
- create_table "way_tags", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :default => 0, :null => false
+ create_table "way_tags", :id => false do |t|
+ t.column "id", :bigint, :default => 0, :null => false
t.column "k", :string
t.column "v", :string
- t.column "version", :bigint, :limit => 20
+ t.column "version", :bigint
end
add_index "way_tags", ["id", "version"], :name => "way_tags_id_version_idx"
- create_table "ways", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :default => 0, :null => false
- t.column "user_id", :bigint, :limit => 20
+ create_table "ways", :id => false do |t|
+ t.column "id", :bigint, :default => 0, :null => false
+ t.column "user_id", :bigint
t.column "timestamp", :datetime
- t.column "version", :bigint, :limit => 20, :null => false
- t.column "visible", :boolean, :default => true
+ t.column "version", :bigint, :null => false
+ t.column "visible", :boolean, :default => true
end
add_primary_key "ways", ["id", "version"]
add_index "ways", ["id"], :name => "ways_id_version_idx"
-
- change_column "ways", "version", :bigint_auto_20
end
def self.down
class CleanupOsmDb < ActiveRecord::Migration
def self.up
- change_column "current_nodes", "latitude", :double, :null => false
- change_column "current_nodes", "longitude", :double, :null => false
- change_column "current_nodes", "user_id", :bigint, :limit => 20, :null => false
+ change_column "current_nodes", "latitude", :float, :limit => 53, :null => false
+ change_column "current_nodes", "longitude", :float, :limit => 53, :null => false
+ change_column "current_nodes", "user_id", :bigint, :null => false
change_column "current_nodes", "visible", :boolean, :null => false
change_column "current_nodes", "timestamp", :datetime, :null => false
add_primary_key "current_nodes", ["id"]
remove_index "current_nodes", :name => "current_nodes_id_idx"
- change_column "current_segments", "node_a", :bigint, :limit => 64, :null => false
- change_column "current_segments", "node_b", :bigint, :limit => 64, :null => false
- change_column "current_segments", "user_id", :bigint, :limit => 20, :null => false
+ change_column "current_segments", "node_a", :bigint, :null => false
+ change_column "current_segments", "node_b", :bigint, :null => false
+ change_column "current_segments", "user_id", :bigint, :null => false
change_column "current_segments", "visible", :boolean, :null => false
change_column "current_segments", "timestamp", :datetime, :null => false
add_primary_key "current_segments", ["id"]
remove_index "current_segments", :name => "current_segments_id_visible_idx"
- change_column "current_way_segments", "id", :bigint, :limit => 64, :null => false
- change_column "current_way_segments", "segment_id", :bigint, :limit => 64, :null => false
- change_column "current_way_segments", "sequence_id", :bigint, :limit => 11, :null => false
+ change_column "current_way_segments", "id", :bigint, :null => false
+ change_column "current_way_segments", "segment_id", :bigint, :null => false
+ change_column "current_way_segments", "sequence_id", :bigint, :null => false
add_primary_key "current_way_segments", ["id", "sequence_id"]
remove_index "current_way_segments", :name => "current_way_segments_id_idx"
- change_column "current_way_tags", "id", :bigint, :limit => 64, :null => false
+ change_column "current_way_tags", "id", :bigint, :null => false
- change_column "current_ways", "user_id", :bigint, :limit => 20, :null => false
+ change_column "current_ways", "user_id", :bigint, :null => false
change_column "current_ways", "timestamp", :datetime, :null => false
change_column "current_ways", "visible", :boolean, :null => false
- change_engine "current_ways", "InnoDB"
change_column "diary_entries", "title", :string, :null => false
change_column "diary_entries", "body", :text, :null => false
change_column "gps_points", "trackid", :integer, :null => false
change_column "gps_points", "latitude", :integer, :null => false
change_column "gps_points", "longitude", :integer, :null => false
- change_column "gps_points", "gpx_id", :bigint, :limit => 64, :null => false
+ change_column "gps_points", "gpx_id", :bigint, :null => false
change_column "gpx_file_tags", "tag", :string, :null => false
- change_column "gpx_files", "user_id", :bigint, :limit => 20, :null => false
+ change_column "gpx_files", "user_id", :bigint, :null => false
change_column "gpx_files", "timestamp", :datetime, :null => false
change_column "gpx_files", "description", :string, :default => "", :null => false
change_column "gpx_files", "inserted", :boolean, :null => false
drop_table "meta_areas"
- change_column "nodes", "id", :bigint, :limit => 64, :null => false
- change_column "nodes", "latitude", :double, :null => false
- change_column "nodes", "longitude", :double, :null => false
- change_column "nodes", "user_id", :bigint, :limit => 20, :null => false
+ change_column "nodes", "id", :bigint, :null => false
+ change_column "nodes", "latitude", :float, :limit => 53, :null => false
+ change_column "nodes", "longitude", :float, :limit => 53, :null => false
+ change_column "nodes", "user_id", :bigint, :null => false
change_column "nodes", "visible", :boolean, :null => false
change_column "nodes", "timestamp", :datetime, :null => false
add_index "nodes", ["timestamp"], :name => "nodes_timestamp_idx"
- change_column "segments", "id", :bigint, :limit => 64, :null => false
- change_column "segments", "node_a", :bigint, :limit => 64, :null => false
- change_column "segments", "node_b", :bigint, :limit => 64, :null => false
- change_column "segments", "user_id", :bigint, :limit => 20, :null => false
+ change_column "segments", "id", :bigint, :null => false
+ change_column "segments", "node_a", :bigint, :null => false
+ change_column "segments", "node_b", :bigint, :null => false
+ change_column "segments", "user_id", :bigint, :null => false
change_column "segments", "visible", :boolean, :null => false
change_column "segments", "timestamp", :datetime, :null => false
add_index "segments", ["timestamp"], :name => "segments_timestamp_idx"
change_column "users", "creation_time", :datetime, :null => false
change_column "users", "display_name", :string, :default => "", :null => false
change_column "users", "data_public", :boolean, :default => false, :null => false
- change_column "users", "home_lat", :double, :default => nil
- change_column "users", "home_lon", :double, :default => nil
+ change_column "users", "home_lat", :float, :limit => 53, :default => nil
+ change_column "users", "home_lon", :float, :limit => 53, :default => nil
remove_index "users", :name => "users_email_idx"
add_index "users", ["email"], :name => "users_email_idx", :unique => true
remove_index "users", :name => "users_display_name_idx"
add_index "users", ["display_name"], :name => "users_display_name_idx", :unique => true
- change_column "way_segments", "segment_id", :bigint, :limit => 64, :null => false
+ change_column "way_segments", "segment_id", :bigint, :null => false
change_column "way_tags", "k", :string, :null => false
change_column "way_tags", "v", :string, :null => false
- change_column "way_tags", "version", :bigint, :limit => 20, :null => false
+ change_column "way_tags", "version", :bigint, :null => false
- change_column "ways", "user_id", :bigint, :limit => 20, :null => false
+ change_column "ways", "user_id", :bigint, :null => false
change_column "ways", "timestamp", :datetime, :null => false
change_column "ways", "visible", :boolean, :default => true, :null => false
remove_index "ways", :name => "ways_id_version_idx"
add_index "ways", ["id"], :name => "ways_id_version_idx"
change_column "ways", "visible", :boolean, :default => true
change_column "ways", "timestamp", :datetime
- change_column "ways", "user_id", :bigint, :limit => 20
+ change_column "ways", "user_id", :bigint
- change_column "way_tags", "version", :bigint, :limit => 20
+ change_column "way_tags", "version", :bigint
change_column "way_tags", "v", :string, :default => nil
change_column "way_tags", "k", :string, :default => nil
add_index "users", ["display_name"], :name => "users_display_name_idx"
remove_index "users", :name => "users_email_idx"
add_index "users", ["email"], :name => "users_email_idx"
- change_column "users", "home_lon", :double, :default => 1
- change_column "users", "home_lat", :double, :default => 1
+ change_column "users", "home_lon", :float, :limit => 53, :default => 1
+ change_column "users", "home_lat", :float, :limit => 53, :default => 1
change_column "users", "data_public", :boolean, :default => false
change_column "users", "display_name", :string, :default => ""
change_column "users", "creation_time", :datetime
remove_index "segments", :name => "segments_timestamp_idx"
change_column "segments", "timestamp", :datetime
change_column "segments", "visible", :boolean
- change_column "segments", "user_id", :bigint, :limit => 20
- change_column "segments", "node_b", :bigint, :limit => 64
- change_column "segments", "node_a", :bigint, :limit => 64
- change_column "segments", "id", :bigint, :limit => 64
+ change_column "segments", "user_id", :bigint
+ change_column "segments", "node_b", :bigint
+ change_column "segments", "node_a", :bigint
+ change_column "segments", "id", :bigint
remove_index "nodes", :name => "nodes_timestamp_idx"
change_column "nodes", "timestamp", :datetime
change_column "nodes", "visible", :boolean
- change_column "nodes", "user_id", :bigint, :limit => 20
- change_column "nodes", "longitude", :double
- change_column "nodes", "latitude", :double
- change_column "nodes", "id", :bigint, :limit => 64
-
- create_table "meta_areas", myisam_table do |t|
- t.column "id", :bigint_pk_64, :null => false
- t.column "user_id", :bigint, :limit => 20
+ change_column "nodes", "user_id", :bigint
+ change_column "nodes", "longitude", :float, :limit => 53
+ change_column "nodes", "latitude", :float, :limit => 53
+ change_column "nodes", "id", :bigint
+
+ create_table "meta_areas", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint
t.column "timestamp", :datetime
end
change_column "messages", "body", :text
change_column "messages", "title", :string, :default => nil
add_column "messages", "from_display_name", :string, :default => ""
- add_column "messages", "user_id", :bigint, :limit => 20, :null => false
+ add_column "messages", "user_id", :bigint, :null => false
add_index "messages", ["from_display_name"], :name => "from_name_idx"
- create_table "gpx_pending_files", myisam_table do |t|
+ create_table "gpx_pending_files", :id => false do |t|
t.column "originalname", :string
- t.column "tmpname", :string
- t.column "user_id", :bigint, :limit => 20
+ t.column "tmpname", :string
+ t.column "user_id", :bigint
end
change_column "gpx_files", "inserted", :boolean
change_column "gpx_files", "description", :string, :default => ""
change_column "gpx_files", "timestamp", :datetime
- change_column "gpx_files", "user_id", :bigint, :limit => 20
+ change_column "gpx_files", "user_id", :bigint
change_column "gpx_file_tags", "tag", :string, :default => nil
- change_column "gps_points", "gpx_id", :integer, :limit => 20
+ change_column "gps_points", "gpx_id", :integer
change_column "gps_points", "longitude", :integer
change_column "gps_points", "latitude", :integer
change_column "gps_points", "trackid", :integer
- add_column "gps_points", "user_id", :integer, :limit => 20
+ add_column "gps_points", "user_id", :integer
add_index "gps_points", ["user_id"], :name => "points_uid_idx"
remove_index "friends", :name => "friends_user_id_idx"
change_column "diary_entries", "body", :text
change_column "diary_entries", "title", :string, :default => nil
- change_engine "current_ways", "MyISAM"
change_column "current_ways", "visible", :boolean
change_column "current_ways", "timestamp", :datetime
- change_column "current_ways", "user_id", :bigint, :limit => 20
+ change_column "current_ways", "user_id", :bigint
- change_column "current_way_tags", "id", :bigint, :limit => 64
+ change_column "current_way_tags", "id", :bigint
add_index "current_way_segments", ["id"], :name => "current_way_segments_id_idx"
remove_primary_key "current_way_segments"
- change_column "current_way_segments", "sequence_id", :bigint, :limit => 11
- change_column "current_way_segments", "segment_id", :bigint, :limit => 11
- change_column "current_way_segments", "id", :bigint, :limit => 64
+ change_column "current_way_segments", "sequence_id", :bigint
+ change_column "current_way_segments", "segment_id", :bigint
+ change_column "current_way_segments", "id", :bigint
add_index "current_segments", ["id", "visible"], :name => "current_segments_id_visible_idx"
remove_primary_key "current_segments"
change_column "current_segments", "timestamp", :datetime
change_column "current_segments", "visible", :boolean
- change_column "current_segments", "user_id", :bigint, :limit => 20
- change_column "current_segments", "node_b", :bigint, :limit => 64
- change_column "current_segments", "node_a", :bigint, :limit => 64
+ change_column "current_segments", "user_id", :bigint
+ change_column "current_segments", "node_b", :bigint
+ change_column "current_segments", "node_a", :bigint
add_index "current_nodes", ["id"], :name => "current_nodes_id_idx"
remove_primary_key "current_nodes"
change_column "current_nodes", "timestamp", :datetime
change_column "current_nodes", "visible", :boolean
- change_column "current_nodes", "user_id", :bigint, :limit => 20
- change_column "current_nodes", "longitude", :double
- change_column "current_nodes", "latitude", :double
- change_column "current_nodes", "id", :bigint_auto_64
+ change_column "current_nodes", "user_id", :bigint
+ change_column "current_nodes", "longitude", :float, :limit => 53
+ change_column "current_nodes", "latitude", :float, :limit => 53
end
end
class SqlSessionStoreSetup < ActiveRecord::Migration
def self.up
- create_table "sessions", :options => innodb_option do |t|
+ create_table "sessions" do |t|
t.column "session_id", :string
t.column "data", :text
t.column "created_at", :timestamp
class UserEnhancements < ActiveRecord::Migration
def self.up
- add_column "diary_entries", "latitude", :double
- add_column "diary_entries", "longitude", :double
+ add_column "diary_entries", "latitude", :float, :limit => 53
+ add_column "diary_entries", "longitude", :float, :limit => 53
add_column "diary_entries", "language", :string, :limit => 3
- create_table "user_preferences", innodb_table do |t|
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "k", :string, :null => false
- t.column "v", :string, :null => false
+ create_table "user_preferences", :id => false do |t|
+ t.column "user_id", :bigint, :null => false
+ t.column "k", :string, :null => false
+ t.column "v", :string, :null => false
end
add_primary_key "user_preferences", ["user_id", "k"]
- create_table "user_tokens", innodb_table do |t|
- t.column "id", :bigint_pk, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "token", :string, :null => false
- t.column "expiry", :datetime, :null => false
+ create_table "user_tokens", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "token", :string, :null => false
+ t.column "expiry", :datetime, :null => false
end
add_index "user_tokens", ["token"], :name => "user_tokens_token_idx", :unique => true
def self.down
remove_column "users", "pass_salt"
remove_column "users", "nearby"
- add_column "users", "within_lat", :double
- add_column "users", "within_lon", :double
+ add_column "users", "within_lat", :float, :limit => 53
+ add_column "users", "within_lon", :float, :limit => 53
add_column "users", "timeout", :datetime
add_column "users", "token", :string
class TileTracepoints < ActiveRecord::Migration
def self.up
- add_column "gps_points", "tile", :four_byte_unsigned
+ add_column "gps_points", "tile", :bigint
add_index "gps_points", ["tile"], :name => "points_tile_idx"
remove_index "gps_points", :name => "points_idx"
rename_table "current_nodes", "current_nodes_v5"
- create_table "current_nodes", innodb_table do |t|
- t.column "id", :bigint_pk_64, :null => false
- t.column "latitude", :integer, :null => false
- t.column "longitude", :integer, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "visible", :boolean, :null => false
- t.column "tags", :text, :default => "", :null => false
- t.column "timestamp", :datetime, :null => false
- t.column "tile", :integer, :null => false
+ create_table "current_nodes", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "latitude", :integer, :null => false
+ t.column "longitude", :integer, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "visible", :boolean, :null => false
+ t.column "tags", :text, :default => "", :null => false
+ t.column "timestamp", :datetime, :null => false
+ t.column "tile", :integer, :null => false
end
add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
add_index "current_nodes", ["tile"], :name => "current_nodes_tile_idx"
- change_column "current_nodes", "tile", :four_byte_unsigned
+ change_column "current_nodes", "tile", :bigint
upgrade_table "current_nodes_v5", "current_nodes", Node
remove_index "nodes", :name=> "nodes_timestamp_idx"
rename_table "nodes", "nodes_v5"
- create_table "nodes", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :null => false
- t.column "latitude", :integer, :null => false
- t.column "longitude", :integer, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "visible", :boolean, :null => false
- t.column "tags", :text, :default => "", :null => false
- t.column "timestamp", :datetime, :null => false
- t.column "tile", :integer, :null => false
+ create_table "nodes", :id => false do |t|
+ t.column "id", :bigint, :null => false
+ t.column "latitude", :integer, :null => false
+ t.column "longitude", :integer, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "visible", :boolean, :null => false
+ t.column "tags", :text, :default => "", :null => false
+ t.column "timestamp", :datetime, :null => false
+ t.column "tile", :integer, :null => false
end
add_index "nodes", ["id"], :name => "nodes_uid_idx"
add_index "nodes", ["timestamp"], :name => "nodes_timestamp_idx"
add_index "nodes", ["tile"], :name => "nodes_tile_idx"
- change_column "nodes", "tile", :four_byte_unsigned
+ change_column "nodes", "tile", :bigint
upgrade_table "nodes_v5", "nodes", OldNode
def self.down
rename_table "current_nodes", "current_nodes_v6"
- create_table "current_nodes", innodb_table do |t|
- t.column "id", :bigint_pk_64, :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 "tags", :text, :default => "", :null => false
- t.column "timestamp", :datetime, :null => false
+ create_table "current_nodes", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "latitude", :float, :limit => 53, :null => false
+ t.column "longitude", :float, :limit => 53, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "visible", :boolean, :null => false
+ t.column "tags", :text, :default => "", :null => false
+ t.column "timestamp", :datetime, :null => false
end
add_index "current_nodes", ["latitude", "longitude"], :name => "current_nodes_lat_lon_idx"
rename_table "nodes", "nodes_v6"
- create_table "nodes", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :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 "tags", :text, :default => "", :null => false
- t.column "timestamp", :datetime, :null => false
+ create_table "nodes", :id => false do |t|
+ t.column "id", :bigint, :null => false
+ t.column "latitude", :float, :limit => 53, :null => false
+ t.column "longitude", :float, :limit => 53, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "visible", :boolean, :null => false
+ t.column "tags", :text, :default => "", :null => false
+ t.column "timestamp", :datetime, :null => false
end
add_index "nodes", ["id"], :name => "nodes_uid_idx"
# differences:
# way: only nodes / relation: any kind of member
# way: ordered sequence of nodes / relation: free-form "role" string
- create_table "current_relation_members", innodb_table do |t|
- t.column "id", :bigint, :limit => 64, :null => false
+ create_table "current_relation_members", :id => false do |t|
+ t.column "id", :bigint, :null => false
t.column "member_type", :nwr_enum, :null => false
- t.column "member_id", :bigint, :limit => 11, :null => false
+ t.column "member_id", :bigint, :null => false
t.column "member_role", :string
end
add_index "current_relation_members", ["member_type", "member_id"], :name => "current_relation_members_member_idx"
# the following is obsolete given the primary key, is it not?
# add_index "current_relation_members", ["id"], :name => "current_relation_members_id_idx"
- create_table "current_relation_tags", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :null => false
+ create_table "current_relation_tags", :id => false do |t|
+ t.column "id", :bigint, :null => false
t.column "k", :string, :default => "", :null => false
t.column "v", :string, :default => "", :null => false
end
add_index "current_relation_tags", ["id"], :name => "current_relation_tags_id_idx"
- add_fulltext_index "current_relation_tags", "v"
+ add_index "current_relation_tags", "v", :name => "current_relation_tags_v_idx"
- create_table "current_relations", innodb_table do |t|
- t.column "id", :bigint_pk_64, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
+ create_table "current_relations", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint, :null => false
t.column "timestamp", :datetime, :null => false
- t.column "visible", :boolean, :null => false
+ t.column "visible", :boolean, :null => false
end
- create_table "relation_members", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :default => 0, :null => false
+ create_table "relation_members", :id => false do |t|
+ t.column "id", :bigint, :default => 0, :null => false
t.column "member_type", :nwr_enum, :null => false
- t.column "member_id", :bigint, :limit => 11, :null => false
+ t.column "member_id", :bigint, :null => false
t.column "member_role", :string
- t.column "version", :bigint, :limit => 20, :default => 0, :null => false
+ t.column "version", :bigint, :default => 0, :null => false
end
add_primary_key "relation_members", ["id", "version", "member_type", "member_id", "member_role"]
add_index "relation_members", ["member_type", "member_id"], :name => "relation_members_member_idx"
- create_table "relation_tags", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :default => 0, :null => false
+ create_table "relation_tags", :id => false do |t|
+ t.column "id", :bigint, :default => 0, :null => false
t.column "k", :string, :null => false, :default => ""
t.column "v", :string, :null => false, :default => ""
- t.column "version", :bigint, :limit => 20, :null => false
+ t.column "version", :bigint, :null => false
end
add_index "relation_tags", ["id", "version"], :name => "relation_tags_id_version_idx"
- create_table "relations", myisam_table do |t|
- t.column "id", :bigint, :limit => 64, :null => false, :default => 0
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "timestamp", :datetime, :null => false
- t.column "version", :bigint, :limit => 20, :null => false
- t.column "visible", :boolean, :null => false, :default => true
+ create_table "relations", :id => false do |t|
+ t.column "id", :bigint, :null => false, :default => 0
+ t.column "user_id", :bigint, :null => false
+ t.column "timestamp", :datetime, :null => false
+ t.column "version", :bigint, :null => false
+ t.column "visible", :boolean, :null => false, :default => true
end
add_primary_key "relations", ["id", "version"]
add_index "relations", ["timestamp"], :name => "relations_timestamp_idx"
-
- change_column "relations", "version", :bigint_auto_20
end
-
def self.down
drop_table :relations
drop_table :current_relations
drop_table :segments
drop_table :way_segments
- create_table :way_nodes, myisam_table do |t|
- t.column :id, :bigint, :limit => 64, :null => false
- t.column :node_id, :bigint, :limit => 64, :null => false
- t.column :version, :bigint, :limit => 20, :null => false
- t.column :sequence_id, :bigint, :limit => 11, :null => false
+ create_table :way_nodes, :id => false do |t|
+ t.column :id, :bigint, :null => false
+ t.column :node_id, :bigint, :null => false
+ t.column :version, :bigint, :null => false
+ t.column :sequence_id, :bigint, :null => false
end
add_primary_key :way_nodes, [:id, :version, :sequence_id]
drop_table :current_segments
drop_table :current_way_segments
- create_table :current_way_nodes, innodb_table do |t|
- t.column :id, :bigint, :limit => 64, :null => false
- t.column :node_id, :bigint, :limit => 64, :null => false
- t.column :sequence_id, :bigint, :limit => 11, :null => false
+ create_table :current_way_nodes, :id => false do |t|
+ t.column :id, :bigint, :null => false
+ t.column :node_id, :bigint, :null => false
+ t.column :sequence_id, :bigint, :null => false
end
add_primary_key :current_way_nodes, [:id, :sequence_id]
add_index :current_way_nodes, [:node_id], :name => "current_way_nodes_node_idx"
class DiaryComments < ActiveRecord::Migration
def self.up
- create_table "diary_comments", myisam_table do |t|
- t.column "id", :bigint_pk, :null => false
- t.column "diary_entry_id", :bigint, :limit => 20, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "body", :text, :null => false
- t.column "created_at", :datetime, :null => false
- t.column "updated_at", :datetime, :null => false
+ create_table "diary_comments", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "diary_entry_id", :bigint, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "body", :text, :null => false
+ t.column "created_at", :datetime, :null => false
+ t.column "updated_at", :datetime, :null => false
end
add_index "diary_comments", ["diary_entry_id", "id"], :name => "diary_comments_entry_id_idx", :unique => true
class CreateAcls < ActiveRecord::Migration
def self.up
- create_table "acls", myisam_table do |t|
- t.column "id", :integer_pk, :null => false
- t.column "address", :inet, :null => false
- t.column "netmask", :inet, :null => false
- t.column "k", :string, :null => false
+ create_table "acls", :id => false do |t|
+ t.column "id", :primary_key, :null => false
+ t.column "address", :inet, :null => false
+ t.column "netmask", :inet, :null => false
+ t.column "k", :string, :null => false
t.column "v", :string
end
remove_column :nodes, :tags
remove_column :current_nodes, :tags
- add_column :nodes, :version, :bigint, :limit => 20, :null => false
+ add_column :nodes, :version, :bigint, :null => false
- create_table :current_node_tags, innodb_table do |t|
- t.column :id, :bigint, :limit => 64, :null => false
+ create_table :current_node_tags, :id => false do |t|
+ t.column :id, :bigint, :null => false
t.column :k, :string, :default => "", :null => false
t.column :v, :string, :default => "", :null => false
end
- create_table :node_tags, innodb_table do |t|
- t.column :id, :bigint, :limit => 64, :null => false
- t.column :version, :bigint, :limit => 20, :null => false
+ create_table :node_tags, :id => false do |t|
+ t.column :id, :bigint, :null => false
+ t.column :version, :bigint, :null => false
t.column :k, :string, :default => "", :null => false
t.column :v, :string, :default => "", :null => false
end
remove_index :current_relation_tags, :name=> :current_relation_tags_v_idx
@@ver_tbl.each { |tbl|
- change_column tbl, "version", :bigint, :limit => 20, :null => false
- }
-
- @@conv_tables.each { |tbl|
- change_engine tbl, "InnoDB"
+ change_column tbl, "version", :bigint, :null => false
}
@@ver_tbl.each { |tbl|
- add_column "current_#{tbl}", "version", :bigint, :limit => 20, :null => false
+ add_column "current_#{tbl}", "version", :bigint, :null => false
# As the initial version of all nodes, ways and relations is 0, we set the
# current version to something less so that we can update the version in
# batches of 10000
remove_index :nodes, :name => :nodes_uid_idx
# Foreign keys (between ways, way_tags, way_nodes, etc.)
- add_foreign_key :current_node_tags, [:id], :current_nodes
- add_foreign_key :node_tags, [:id, :version], :nodes
+ add_foreign_key :current_node_tags, :current_nodes, :column => :id, :name => "current_node_tags_id_fkey"
+ add_foreign_key :node_tags, :nodes, :column => [:id, :version], :primary_key => [:id, :version], :name => "node_tags_id_fkey"
- add_foreign_key :current_way_tags, [:id], :current_ways
- add_foreign_key :current_way_nodes, [:id], :current_ways
- add_foreign_key :way_tags, [:id, :version], :ways
- add_foreign_key :way_nodes, [:id, :version], :ways
+ add_foreign_key :current_way_tags, :current_ways, :column => :id, :name => "current_way_tags_id_fkey"
+ add_foreign_key :current_way_nodes, :current_ways, :column => :id, :name => "current_way_nodes_id_fkey"
+ add_foreign_key :way_tags, :ways, :column => [:id, :version], :primary_key => [:id, :version], :name => "way_tags_id_fkey"
+ add_foreign_key :way_nodes, :ways, :column => [:id, :version], :primary_key => [:id, :version], :name => "way_nodes_id_fkey"
- add_foreign_key :current_relation_tags, [:id], :current_relations
- add_foreign_key :current_relation_members, [:id], :current_relations
- add_foreign_key :relation_tags, [:id, :version], :relations
- add_foreign_key :relation_members, [:id, :version], :relations
+ add_foreign_key :current_relation_tags, :current_relations, :column => :id, :name => "current_relation_tags_id_fkey"
+ add_foreign_key :current_relation_members, :current_relations, :column => :id, :name => "current_relation_members_id_fkey"
+ add_foreign_key :relation_tags, :relations, :column => [:id, :version], :primary_key => [:id, :version], :name => "relation_tags_id_fkey"
+ add_foreign_key :relation_members, :relations, :column => [:id, :version], :primary_key => [:id, :version], :name => "relation_members_id_fkey"
# Foreign keys (between different types of primitives)
- add_foreign_key :current_way_nodes, [:node_id], :current_nodes, [:id]
+ add_foreign_key :current_way_nodes, :current_nodes, :column => :node_id, :name => "current_way_nodes_node_id_fkey"
# FIXME: We don't have foreign keys for relation members since the id
# might point to a different table depending on the `type' column.
'current_relations', 'current_ways', 'nodes', 'relations', 'ways' ]
def self.up
- create_table "changesets", innodb_table do |t|
- t.column "id", :bigint_pk, :null => false
- t.column "user_id", :bigint, :limit => 20, :null => false
- t.column "created_at", :datetime, :null => false
- t.column "open", :boolean, :null => false, :default => true
- t.column "min_lat", :integer, :null => true
- t.column "max_lat", :integer, :null => true
- t.column "min_lon", :integer, :null => true
- t.column "max_lon", :integer, :null => true
+ create_table "changesets", :id => false do |t|
+ t.column "id", :bigserial, :primary_key => true, :null => false
+ t.column "user_id", :bigint, :null => false
+ t.column "created_at", :datetime, :null => false
+ t.column "open", :boolean, :null => false, :default => true
+ t.column "min_lat", :integer, :null => true
+ t.column "max_lat", :integer, :null => true
+ t.column "min_lon", :integer, :null => true
+ t.column "max_lon", :integer, :null => true
end
- create_table "changeset_tags", innodb_table do |t|
- t.column "id", :bigint, :limit => 64, :null => false
+ create_table "changeset_tags", :id => false do |t|
+ t.column "id", :bigint, :null => false
t.column "k", :string, :default => "", :null => false
t.column "v", :string, :default => "", :null => false
end
@@conv_user_tables.each { |tbl|
rename_column tbl, :user_id, :changeset_id
#foreign keys too
- add_foreign_key tbl, [:changeset_id], :changesets, [:id]
+ add_foreign_key tbl, :changesets, :name => "#{tbl}_changeset_id_fkey"
}
end
# it appears that execute will only accept string arguments, so
# this is an ugly, ugly hack to get some sort of mysql/postgres
# independence. now i have to go wash my brain with bleach.
- execute("update changesets set closed_at=(now()-#{interval_constant('1 hour')}) where open=(1=0)")
- execute("update changesets set closed_at=(now()+#{interval_constant('1 hour')}) where open=(1=1)")
+ execute("update changesets set closed_at=(now()-'1 hour'::interval) where open=(1=0)")
+ execute("update changesets set closed_at=(now()+'1 hour'::interval) where open=(1=1)")
# remove the open column as it is unnecessary now and denormalises
# the table.
def self.up
add_index "changesets", ["created_at"], :name => "changesets_created_at_idx"
add_index "changesets", ["closed_at"], :name => "changesets_closed_at_idx"
- add_index "changesets", ["min_lat","max_lat","min_lon","max_lon"], :name => "changesets_bbox_idx", :method => "GIST"
+ add_index "changesets", ["min_lat","max_lat","min_lon","max_lon"], :name => "changesets_bbox_idx", :using => "GIST"
end
def self.down
require 'migrate'
class AddUserForeignKeys < ActiveRecord::Migration
- def self.up
- add_foreign_key :changesets, [:user_id], :users, [:id]
- add_foreign_key :diary_comments, [:user_id], :users, [:id]
- add_foreign_key :diary_entries, [:user_id], :users, [:id]
- add_foreign_key :friends, [:user_id], :users, [:id]
- add_foreign_key :friends, [:friend_user_id], :users, [:id]
- add_foreign_key :gpx_files, [:user_id], :users, [:id]
- add_foreign_key :messages, [:from_user_id], :users, [:id]
- add_foreign_key :messages, [:to_user_id], :users, [:id]
- add_foreign_key :user_preferences, [:user_id], :users, [:id]
- add_foreign_key :user_tokens, [:user_id], :users, [:id]
- end
-
- def self.down
- raise ActiveRecord::IrreversibleMigration
+ def change
+ add_foreign_key :changesets, :users, :name => "changesets_user_id_fkey"
+ add_foreign_key :diary_comments, :users, :name => "diary_comments_user_id_fkey"
+ add_foreign_key :diary_entries, :users, :name => "diary_entries_user_id_fkey"
+ add_foreign_key :friends, :users, :name => "friends_user_id_fkey"
+ add_foreign_key :friends, :users, :column => :friend_user_id, :name => "friends_friend_user_id_fkey"
+ add_foreign_key :gpx_files, :users, :name => "gpx_files_user_id_fkey"
+ add_foreign_key :messages, :users, :column => :from_user_id, :name => "messages_from_user_id_fkey"
+ add_foreign_key :messages, :users, :column => :to_user_id, :name => "messages_to_user_id_fkey"
+ add_foreign_key :user_preferences, :users, :name => "user_preferences_user_id_fkey"
+ add_foreign_key :user_tokens, :users, :name => "user_tokens_user_id_fkey"
end
end
class AddForeignKeys < ActiveRecord::Migration
def self.up
- add_foreign_key :changeset_tags, [:id], :changesets
- add_foreign_key :diary_comments, [:diary_entry_id], :diary_entries, [:id]
- add_foreign_key :gps_points, [:gpx_id], :gpx_files, [:id]
- add_foreign_key :gpx_file_tags, [:gpx_id], :gpx_files, [:id]
+ add_foreign_key :changeset_tags, :changesets, :column => :id, :name => "changeset_tags_id_fkey"
+ add_foreign_key :diary_comments, :diary_entries, :name => "diary_comments_diary_entry_id_fkey"
+ add_foreign_key :gps_points, :gpx_files, :column => :gpx_id, :name => "gps_points_gpx_id_fkey"
+ add_foreign_key :gpx_file_tags, :gpx_files, :column => :gpx_id, :name => "gpx_file_tags_gpx_id_fkey"
end
def self.down
class CreateCountries < ActiveRecord::Migration
def self.up
- create_table :countries, innodb_table do |t|
- t.column :id, :integer_pk, :null => false
- t.column :code, :string, :limit => 2, :null => false
- t.column :min_lat, :double, :null => false
- t.column :max_lat, :double, :null => false
- t.column :min_lon, :double, :null => false
- t.column :max_lon, :double, :null => false
+ create_table :countries, :id => false do |t|
+ t.column :id, :primary_key, :null => false
+ t.column :code, :string, :limit => 2, :null => false
+ t.column :min_lat, :float, :limit => 53, :null => false
+ t.column :max_lat, :float, :limit => 53, :null => false
+ t.column :min_lon, :float, :limit => 53, :null => false
+ t.column :max_lon, :float, :limit => 53, :null => false
end
add_index :countries, [:code], :name => "countries_code_idx", :unique => true
require 'migrate'
class CreateLanguages < ActiveRecord::Migration
- def self.up
- create_table :languages, innodb_table do |t|
+ def change
+ create_table :languages, :id => false do |t|
t.string :code, :null => false
t.string :english_name, :null => false
t.string :native_name
Language.load("#{Rails.root}/config/languages.yml")
- add_foreign_key :users, [:locale], :languages, [:code]
- add_foreign_key :diary_entries, [:language_code], :languages, [:code]
- end
-
- def self.down
- raise ActiveRecord::IrreversibleMigration
+ add_foreign_key :users, :languages, :column => :locale, :primary_key => :code, :name => "users_locale_fkey"
+ add_foreign_key :diary_entries, :languages, :column => :language_code , :primary_key => :code, :name => "diary_entries_language_code_fkey"
end
end
class ChangeUserLocale < ActiveRecord::Migration
def self.up
- remove_foreign_key :users, [:locale], :languages, [:code]
+ remove_foreign_key :users, :column => :locale, :name => "users_locale_fkey"
rename_column :users, :locale, :languages
end
def self.down
rename_column :users, :languages, :locale
- add_foreign_key :users, [:locale], :languages, [:code]
+ add_foreign_key :users, :languages, :column => :locale, :primary_key => :code, :name => "users_locale_fkey"
end
end
require 'migrate'
class AddForeignKeysToOauthTables < ActiveRecord::Migration
- def self.up
- add_foreign_key :oauth_tokens, [:user_id], :users, [:id]
- add_foreign_key :oauth_tokens, [:client_application_id], :client_applications, [:id]
- add_foreign_key :client_applications, [:user_id], :users, [:id]
- end
-
- def self.down
- remove_foreign_key :oauth_tokens, [:user_id], :users
- remove_foreign_key :oauth_tokens, [:client_application_id], :client_applications
- remove_foreign_key :client_applications, [:user_id], :users
+ def change
+ add_foreign_key :oauth_tokens, :users, :name => "oauth_tokens_user_id_fkey"
+ add_foreign_key :oauth_tokens, :client_applications, :name => "oauth_tokens_client_application_id_fkey"
+ add_foreign_key :client_applications, :users, :name => "client_applications_user_id_fkey"
end
end
create_table :user_roles do |t|
t.column :user_id, :bigint, :null => false
+ t.column :role, :user_role_enum, :null => false
t.timestamps
end
- add_column :user_roles, :role, :user_role_enum, :null => false
User.where(:administrator => true).each do |user|
UserRole.create(:user_id => user.id, :role => "administrator")
end
+
remove_column :users, :administrator
- add_foreign_key :user_roles, [:user_id], :users, [:id]
+ add_foreign_key :user_roles, :users, :name => "user_roles_user_id_fkey"
end
def self.down
add_column :users, :administrator, :boolean, :default => false, :null => false
+
UserRole.where(:role => "administrator").each do |role|
user = User.find(role.user_id)
user.administrator = true
user.save!
end
+
drop_table :user_roles
drop_enumeration :user_role_enum
end
require 'migrate'
class CreateUserBlocks < ActiveRecord::Migration
- def self.up
+ def change
create_table :user_blocks do |t|
t.column :user_id, :bigint, :null => false
t.column :moderator_id, :bigint, :null => false
t.timestamps
end
- add_foreign_key :user_blocks, [:user_id], :users, [:id]
- add_foreign_key :user_blocks, [:moderator_id], :users, [:id]
- add_foreign_key :user_blocks, [:revoker_id], :users, [:id]
+ add_foreign_key :user_blocks, :users, :name => "user_blocks_user_id_fkey"
+ add_foreign_key :user_blocks, :users, :column => :moderator_id, :name => "user_blocks_moderator_id_fkey"
+ add_foreign_key :user_blocks, :users, :column => :revoker_id, :name => "user_blocks_revoker_id_fkey"
add_index :user_blocks, [:user_id]
end
-
- def self.down
- drop_table :user_blocks
- end
end
add_column :user_roles, :granter_id, :bigint
UserRole.update_all("granter_id = user_id")
change_column :user_roles, :granter_id, :bigint, :null => false
- add_foreign_key :user_roles, [:granter_id], :users, [:id]
+ add_foreign_key :user_roles, :users, :column => :granter_id, :name => "user_roles_granter_id_fkey"
# make sure that [user_id, role] is unique
add_index :user_roles, [:user_id, :role], :name => "user_roles_id_role_unique", :unique => true
end
def self.down
- remove_column :user_roles, :granter_id
- remove_index :user_roles, :name => "user_roles_id_role_unique"
- rename_column :user_blocks, :creator_id, :moderator_id
rename_column :user_blocks, :ends_at, :end_at
+ rename_column :user_blocks, :creator_id, :moderator_id
+ remove_index :user_roles, :name => "user_roles_id_role_unique"
+ remove_column :user_roles, :granter_id
end
end
add_index :map_bug_comment, [:bug_id], :name => "map_bug_comment_id_idx"
- add_foreign_key :map_bug_comment, [:bug_id], :map_bugs, [:id]
- add_foreign_key :map_bug_comment, [:commenter_id], :users, [:id]
+ add_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
+ add_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
end
def self.down
- remove_foreign_key :map_bug_comment, [:commenter_id]
- remove_foreign_key :map_bug_comment, [:bug_id]
+ remove_foreign_key :map_bug_comment, :users, :column => :commenter_id, :name => "note_comments_author_id_fkey"
+ remove_foreign_key :map_bug_comment, :map_bugs, :column => :bug_id, :name => "note_comments_note_id_fkey"
remove_index :map_bugs, :name => "map_bug_comment_id_idx"
rename_enumeration "map_bug_event_enum", "note_event_enum"
rename_table :map_bugs, :notes
- rename_index :notes, "map_bugs_pkey", "notes_pkey"
rename_index :notes, "map_bugs_changed_idx", "notes_updated_at_idx"
rename_index :notes, "map_bugs_created_idx", "notes_created_at_idx"
rename_index :notes, "map_bugs_tile_idx", "notes_tile_status_idx"
- remove_foreign_key :map_bug_comment, [:bug_id], :map_bugs, [:id]
- rename_column :map_bug_comment, :author_id, :commenter_id
- remove_foreign_key :map_bug_comment, [:commenter_id], :users, [:id]
- rename_column :map_bug_comment, :commenter_id, :author_id
-
rename_table :map_bug_comment, :note_comments
rename_column :note_comments, :bug_id, :note_id
- rename_index :note_comments, "map_bug_comment_pkey", "note_comments_pkey"
rename_index :note_comments, "map_bug_comment_id_idx", "note_comments_note_id_idx"
-
- add_foreign_key :note_comments, [:note_id], :notes, [:id]
- add_foreign_key :note_comments, [:author_id], :users, [:id]
end
def self.down
- remove_foreign_key :note_comments, [:author_id], :users, [:id]
- remove_foreign_key :note_comments, [:note_id], :notes, [:id]
-
rename_index :note_comments, "note_comments_note_id_idx", "map_bug_comment_id_idx"
- rename_index :notes, "note_comments_pkey", "map_bug_comment_pkey"
rename_column :note_comments, :note_id, :bug_id
rename_table :note_comments, :map_bug_comment
- rename_column :map_bug_comment, :author_id, :commenter_id
- add_foreign_key :map_bug_comment, [:commenter_id], :users, [:id]
- rename_column :map_bug_comment, :commenter_id, :author_id
- add_foreign_key :map_bug_comment, [:bug_id], :notes, [:id]
-
rename_index :notes, "notes_tile_status_idx", "map_bugs_tile_idx"
rename_index :notes, "notes_created_at_idx", "map_bugs_created_idx"
rename_index :notes, "notes_updated_at_idx", "map_bugs_changed_idx"
- rename_index :notes, "notes_pkey", "map_bugs_pkey"
rename_table :notes, :map_bugs
rename_enumeration "note_event_enum", "map_bug_event_enum"
class AddLowercaseUserIndexes < ActiveRecord::Migration
def up
- add_index :users, :display_name, :lowercase => true, :name => "users_display_name_lower_idx"
- add_index :users, :email, :lowercase => true, :name => "users_email_lower_idx"
+ add_index :users, [], :columns => "LOWER(display_name)", :name => "users_display_name_lower_idx"
+ add_index :users, [], :columns => "LOWER(email)", :name => "users_email_lower_idx"
end
def down
require 'migrate'
class CreateRedactions < ActiveRecord::Migration
- def up
+ def change
create_table :redactions do |t|
t.string :title
t.text :description
[:nodes, :ways, :relations].each do |tbl|
add_column tbl, :redaction_id, :integer, :null => true
- add_foreign_key tbl, [:redaction_id], :redactions, [:id]
+ add_foreign_key tbl, :redactions, :name => "#{tbl}_redaction_id_fkey"
end
end
-
- def down
- [:nodes, :ways, :relations].each do |tbl|
- remove_foreign_key tbl, [:redaction_id], :redactions, [:id]
- remove_column tbl, :redaction_id
- end
-
- drop_table :redactions
- end
end
end
def down
- create_table "sessions", :options => innodb_option do |t|
+ create_table "sessions" do |t|
t.column "session_id", :string
t.column "data", :text
t.column "created_at", :timestamp
require 'migrate'
class AddUserAndDescriptionToRedaction < ActiveRecord::Migration
- def up
+ def change
add_column :redactions, :user_id, :bigint, :null => false
add_column :redactions, :description_format, :format_enum, :null => false, :default => "markdown"
- add_foreign_key :redactions, [:user_id], :users, [:id]
- end
-
- def down
- remove_foreign_key :redactions, [:user_id], :users, [:id]
-
- remove_column :redactions, :description_format
- remove_column :redactions, :user_id
+ add_foreign_key :redactions, :users, :name => "redactions_user_id_fkey"
end
end
class AddTextIndexToNoteComments < ActiveRecord::Migration
def up
- add_index :note_comments, [], :columns => "to_tsvector('english', body)", :method => "GIN", :name => "index_note_comments_on_body"
+ add_index :note_comments, [], :columns => "to_tsvector('english', body)", :using => "GIN", :name => "index_note_comments_on_body"
end
def down
t.boolean :visible, :null => false
end
- add_foreign_key :changeset_comments, [:changeset_id], :changesets, [:id]
- add_foreign_key :changeset_comments, [:author_id], :users, [:id]
+ add_foreign_key :changeset_comments, :changesets, :name => "changeset_comments_changeset_id_fkey"
+ add_foreign_key :changeset_comments, :users, :column => :author_id, :name => "changeset_comments_author_id_fkey"
add_index :changeset_comments, :created_at
end
t.column :changeset_id, :bigint, null: false
end
- add_foreign_key :changesets_subscribers, [:subscriber_id], :users, [:id]
- add_foreign_key :changesets_subscribers, [:changeset_id], :changesets, [:id]
+ add_foreign_key :changesets_subscribers, :users, :column => :subscriber_id, :name => "changesets_subscribers_subscriber_id_fkey"
+ add_foreign_key :changesets_subscribers, :changesets, :name => "changesets_subscribers_changeset_id_fkey"
add_index :changesets_subscribers, [:subscriber_id, :changeset_id], :unique => true
add_index :changesets_subscribers, [:changeset_id]
--- /dev/null
+class ChangeDefaultFormats < ActiveRecord::Migration
+ def up
+ change_column_default :diary_entries, :body_format, "markdown"
+ change_column_default :diary_comments, :body_format, "markdown"
+ change_column_default :messages, :body_format, "markdown"
+ change_column_default :users, :description_format, "markdown"
+ change_column_default :user_blocks, :reason_format, "markdown"
+ end
+
+ def down
+ change_column_default :diary_entries, :body_format, "html"
+ change_column_default :diary_comments, :body_format, "html"
+ change_column_default :messages, :body_format, "html"
+ change_column_default :users, :description_format, "html"
+ change_column_default :user_blocks, :reason_format, "html"
+ end
+end
CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
---
--- Name: index_changeset_comments_on_body; Type: INDEX; Schema: public; Owner: -; Tablespace:
---
-
-CREATE INDEX index_changeset_comments_on_body ON changeset_comments USING btree (body);
-
-
--
-- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
module ActiveRecord
module ConnectionAdapters
- class PostgreSQLAdapter
- class SchemaCreation
- alias_method :old_add_column_options!, :add_column_options!
+ module SchemaStatements
+ def add_index_options_with_columns(table_name, column_name, options = {})
+ columns = options.delete(:columns)
+ index_name, index_type, index_columns, index_options, algorithm, using = add_index_options_without_columns(table_name, column_name, options)
+ [index_name, index_type, columns || index_columns, index_options, algorithm, using]
+ end
+
+ alias_method_chain :add_index_options, :columns
+ end
- def add_column_options!(sql, options)
- sql << " UNSIGNED" if options[:unsigned]
- old_add_column_options!(sql, options)
- sql << " #{options[:options]}"
+ module PostgreSQL
+ module Quoting
+ def quote_column_name_with_arrays(name)
+ Array(name).map { |n| quote_column_name_without_arrays(n) }.join(", ")
end
+
+ alias_method_chain :quote_column_name, :arrays
end
module SchemaStatements
- def quote_column_names(column_name)
- Array(column_name).map { |e| quote_column_name(e) }.join(", ")
- end
-
def add_primary_key(table_name, column_name, options = {})
- 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 (#{quoted_column_names})"
+ execute "ALTER TABLE #{quote_table_name(table_name)} ADD PRIMARY KEY (#{quote_column_name(column_name)})"
end
def remove_primary_key(table_name)
- execute "ALTER TABLE #{table_name} DROP PRIMARY KEY"
+ execute "ALTER TABLE #{quote_table_name(table_name)} DROP PRIMARY KEY"
end
- def add_foreign_key(table_name, column_name, reftbl, refcol = nil)
- execute "ALTER TABLE #{table_name} ADD " +
- "FOREIGN KEY (#{quote_column_names(column_name)}) " +
- "REFERENCES #{reftbl} (#{quote_column_names(refcol || column_name)})"
+ def alter_primary_key(table_name, new_columns)
+ execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{quote_table_name(table_name + "_pkey")}"
+ execute "ALTER TABLE #{quote_table_name(table_name)} ADD PRIMARY KEY (#{quote_column_name(new_columns)})"
end
- def remove_foreign_key(table_name, column_name, reftbl, refcol = nil)
- execute "ALTER TABLE #{table_name} DROP " +
- "CONSTRAINT #{table_name}_#{column_name[0]}_fkey"
+ def create_enumeration(enumeration_name, values)
+ execute "CREATE TYPE #{enumeration_name} AS ENUM ('#{values.join '\',\''}')"
end
-# alias_method :old_options_include_default?, :options_include_default?
-#
-# def options_include_default?(options)
-# return false if options[:options] =~ /AUTO_INCREMENT/i
-# return old_options_include_default?(options)
-# end
- end
-
- alias_method :old_native_database_types, :native_database_types
-
- def native_database_types
- types = old_native_database_types
- types[:double] = { :name => "double precision" }
- types[:integer_pk] = { :name => "serial PRIMARY KEY" }
- types[:bigint_pk] = { :name => "bigserial PRIMARY KEY" }
- types[:bigint_pk_64] = { :name => "bigserial PRIMARY KEY" }
- types[:bigint_auto_64] = { :name => "bigint" } #fixme: need autoincrement?
- types[:bigint_auto_11] = { :name => "bigint" } #fixme: need autoincrement?
- types[:bigint_auto_20] = { :name => "bigint" } #fixme: need autoincrement?
- types[:four_byte_unsigned] = { :name => "bigint" } # meh
- types[:inet] = { :name=> "inet" }
-
- enumerations.each_key do |e|
- types[e.to_sym]= { :name => e }
+ def drop_enumeration(enumeration_name)
+ execute "DROP TYPE #{enumeration_name}"
end
- types
- end
-
- def myisam_table
- return { :id => false, :force => true, :options => ""}
- end
-
- def innodb_table
- return { :id => false, :force => true, :options => ""}
- end
-
- def innodb_option
- return ""
- end
-
- def change_engine (table_name, engine)
- end
-
- def add_fulltext_index (table_name, column)
- execute "CREATE INDEX #{table_name}_#{column}_idx on #{table_name} (#{column})"
- end
-
- def enumerations
- @enumerations ||= Hash.new
- end
-
- def create_enumeration(enumeration_name, values)
- enumerations[enumeration_name] = values
- execute "CREATE TYPE #{enumeration_name} AS ENUM ('#{values.join '\',\''}')"
- end
-
- def drop_enumeration(enumeration_name)
- execute "DROP TYPE #{enumeration_name}"
- enumerations.delete(enumeration_name)
- end
-
- def rename_enumeration(old_name, new_name)
- execute "ALTER TYPE #{quote_table_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
- end
-
- def alter_primary_key(table_name, new_columns)
- execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{table_name}_pkey"
- execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{new_columns.join(',')})"
- end
-
- def interval_constant(interval)
- "'#{interval}'::interval"
- end
-
- def add_index(table_name, column_name, options = {})
- column_names = Array(column_name)
- index_name = index_name(table_name, :column => column_names)
-
- if Hash === options # legacy support, since this param was a string
- index_type = options[:unique] ? "UNIQUE" : ""
- index_name = options[:name] || index_name
- index_method = options[:method] || "BTREE"
- else
- index_type = options
- end
-
- quoted_column_names = column_names.map { |e| quote_column_name(e) }
- if Hash === options and options[:lowercase]
- quoted_column_names = quoted_column_names.map { |e| "LOWER(#{e})" }
- end
- if Hash === options and options[:columns]
- quoted_column_names = quoted_column_names + Array[options[:columns]]
+ def rename_enumeration(old_name, new_name)
+ execute "ALTER TYPE #{quote_table_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
end
- quoted_column_names = quoted_column_names.join(", ")
-
- execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} USING #{index_method} (#{quoted_column_names})"
- end
-
- def rename_index(table_name, old_name, new_name)
- execute "ALTER INDEX #{quote_table_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
end
end
end
bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
get :trackpoints, :bbox => bbox
assert_response :success
- assert_select "gpx[version='1.0'][creator='OpenStreetMap.org'][xmlns='http://www.topografix.com/GPX/1/0']", :count => 1 do
+ assert_select "gpx[version='1.0'][creator='OpenStreetMap.org']", :count => 1 do
assert_select "trk" do
assert_select "trkseg"
end
bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
get :trackpoints, :bbox => bbox
assert_response :success
- assert_select "gpx[version='1.0'][creator='OpenStreetMap.org'][xmlns='http://www.topografix.com/GPX/1/0']", :count => 1 do
+ assert_select "gpx[version='1.0'][creator='OpenStreetMap.org']", :count => 1 do
assert_select "trk", :count => 1 do
assert_select "trk > trkseg", :count => 2 do |trksegs|
trksegs.each do |trkseg|
bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
get :trackpoints, :bbox => bbox
assert_response :success
- assert_select "gpx[version='1.0'][creator='OpenStreetMap.org'][xmlns='http://www.topografix.com/GPX/1/0']", :count => 1 do
+ assert_select "gpx[version='1.0'][creator='OpenStreetMap.org']", :count => 1 do
assert_select "trk", :count => 1 do
assert_select "trk>name", :count => 1
assert_select "trk>desc", :count => 1
assert_template 'diary_entry/view'
assert_select "title", :text => /Users' diaries | /, :count => 1
assert_select "div.content-heading", :count => 1 do
- assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
+ assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
end
assert_select "div#content", :count => 1 do
assert_select "div.post_heading", :text => /#{new_title}/, :count => 1
assert_template 'diary_entry/view'
assert_select "title", :text => /Users' diaries | /, :count => 1
assert_select "div.content-heading", :count => 1 do
- assert_select "h2", :text => /#{users(:normal_user).display_name}'s diary/, :count => 1
+ assert_select "h2", :text => /#{users(:normal_user).display_name}'s diary/, :count => 1
end
assert_select "div#content", :count => 1 do
assert_select "div.post_heading", :text => /#{new_title}/, :count => 1
require 'test_helper'
class RichTextTest < ActiveSupport::TestCase
- include ActionDispatch::Assertions::SelectorAssertions
+ include Rails::Dom::Testing::Assertions::SelectorAssertions
def test_html_to_html
r = RichText.new("html", "foo http://example.com/ bar")
r = RichText.new("text", "foo < bar & baz > qux")
assert_html r do
- assert_select "p", "foo < bar & baz > qux"
+ assert_select "p", "foo < bar & baz > qux"
end
end
def assert_html(richtext, &block)
html = richtext.to_html
assert html.html_safe?
- root = HTML::Document.new(richtext.to_html, false, true).root
+ root = Nokogiri::HTML::DocumentFragment.parse(html)
assert_select root, "*" do
yield block
end