Sha256: d6452cc807c71714aac6709df58c4af125c47dad5d5dbf58aa1344abb3f4644c

Contents?: true

Size: 401 Bytes

Versions: 10

Compression:

Stored size: 401 Bytes

Contents

class AddPublishedAtToPosts < ActiveRecord::Migration
  def self.up
    add_column :posts, :published_at, :datetime

    # Update all existing published posts
    # Set published_at to created_at date for posts that were already published
    # Nope.
    # Post.update_all("published_at = created_at", "published_as = 'live'")
  end

  def self.down
    remove_column :posts, :published_at
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
community_engine-3.2.0 db/migrate/055_add_published_at_to_posts.rb
community_engine-3.0.0 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.3.2 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.3.1 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.3.0 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.1.0 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.0.0 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.0.0.beta3 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.0.0.beta2 db/migrate/055_add_published_at_to_posts.rb
community_engine-2.0.0.beta1 db/migrate/055_add_published_at_to_posts.rb