Sha256: 42d98b5b89dae4360c7fdbfbd456e52aa5ba73d0e1cb9f37f961f12e4e38828d

Contents?: true

Size: 589 Bytes

Versions: 21

Compression:

Stored size: 589 Bytes

Contents

class RemoveTimestampsFromHabtmTables < ActiveRecord::Migration
  TABLES = [
    :areas_projects, :areas_users, :projects_users, :users_roles
  ]
  
  def up
    # Have to remove timestamps from cause of:
    # PG::Error: ERROR:  null value in column "created_at" violates not-null constraint
    TABLES.each do |table|
      remove_column table, :created_at
      remove_column table, :updated_at
    end
  end

  def down
    TABLES.each do |table|
      add_column table, :created_at, :datetime, null: false
      add_column table, :updated_at, :datetime, null: false
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
voluntary-0.7.1 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.7.0 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.6.0 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.5.2 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.5.1 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.5.0 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.4.0 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.3.0 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.2.4 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.2.3 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.2.2 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.2.1 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.2.0 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.1.0 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.1.0.rc4 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.1.0.rc3 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.1.0.rc2 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.1.0.rc1 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.0.3 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb
voluntary-0.0.2 db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb