Feature #24013 » issue-24013-r16009-db-migrate.diff
| db/migrate/007_create_journals.rb | ||
|---|---|---|
|
end
|
||
|
# indexes
|
||
|
add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
|
||
|
add_index "journals", ["journalized_id", "journalized_type"]
|
||
|
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||
|
Permission.create :controller => "issues", :action => "history", :description => "label_history", :sort => 1006, :is_public => true, :mail_option => 0, :mail_enabled => 0
|
||
| db/migrate/107_add_open_id_authentication_tables.rb | ||
|---|---|---|
|
class AddOpenIdAuthenticationTables < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
create_table :open_id_authentication_associations, :force => true do |t|
|
||
|
create_table :open_id_auth_associations, :force => true do |t|
|
||
|
t.integer :issued, :lifetime
|
||
|
t.string :handle, :assoc_type
|
||
|
t.binary :server_url, :secret
|
||
|
end
|
||
|
create_table :open_id_authentication_nonces, :force => true do |t|
|
||
|
create_table :open_id_auth_nonces, :force => true do |t|
|
||
|
t.integer :timestamp, :null => false
|
||
|
t.string :server_url, :null => true
|
||
|
t.string :salt, :null => false
|
||
| ... | ... | |
|
end
|
||
|
def self.down
|
||
|
drop_table :open_id_authentication_associations
|
||
|
drop_table :open_id_authentication_nonces
|
||
|
drop_table :open_id_auth_associations
|
||
|
drop_table :open_id_auth_nonces
|
||
|
end
|
||
|
end
|
||
| db/migrate/20130201184705_add_unique_index_on_tokens_value.rb | ||
|---|---|---|
|
def up
|
||
|
say_with_time "Adding unique index on tokens, this may take some time..." do
|
||
|
# Just in case
|
||
|
duplicates = Token.connection.select_values("SELECT value FROM #{Token.table_name} GROUP BY value HAVING COUNT(id) > 1")
|
||
|
duplicates = Token.group(:value).having('COUNT(id) > 1').select(:value).to_a
|
||
|
Token.where(:value => duplicates).delete_all
|
||
|
|
||
|
add_index :tokens, :value, :unique => true, :name => 'tokens_value'
|
||
| db/migrate/20130215111141_populate_issues_closed_on.rb | ||
|---|---|---|
|
" AND #{Journal.table_name}.journalized_type = 'Issue' AND #{Journal.table_name}.journalized_id = #{Issue.table_name}.id" +
|
||
|
" AND #{JournalDetail.table_name}.property = 'attr' AND #{JournalDetail.table_name}.prop_key = 'status_id'" +
|
||
|
" AND #{JournalDetail.table_name}.old_value NOT IN (#{closed_status_values})" +
|
||
|
" AND #{JournalDetail.table_name}.value IN (#{closed_status_values})"
|
||
|
" AND #{JournalDetail.table_name}.#{'value'.quote_column_name} IN (#{closed_status_values})"
|
||
|
Issue.update_all "closed_on = (#{subselect})"
|
||
|
# Then set closed_on for closed issues that weren't up updated by the above UPDATE
|
||