Sha256: 0adb0daf4631f0f57fd9cafdaf0342e21eb13b58c7820805c8f6989dc4c9b058

Contents?: true

Size: 935 Bytes

Versions: 8

Compression:

Stored size: 935 Bytes

Contents

class CreateCacheInformations < ActiveRecord::Migration
  def self.up

    # With this migration, Old cache is useless. So we need delete all old cache
    # Now what page is in cache is manage by cache_informations table
    PageCache.old_sweep_all

    # In commit before, cache manage by file. We delete this cache if exist.
    # It's use only to all edge blog updated several time
    if File.exist?(File.join(Rails.root,'path_cache'))
      File.read(File.join(Rails.root,'path_cache')).split("\n").each do |page_save|
        FileUtils.rm File.join(PageCache.public_path, page_save)
      end
      FileUtils.rm_f File.join(Rails.root,'path_cache')
    end

    create_table :cache_informations do |t|
      t.string :path
      t.timestamps
    end
    # Add index on path because there are validates_uniqueness on it
    add_index :cache_informations, :path
  end

  def self.down
    drop_table :cache_informations
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
typo-5.5 db/migrate/081_create_cache_informations.rb
typo-5.4.4 db/migrate/081_create_cache_informations.rb
typo-5.4.3 db/migrate/081_create_cache_informations.rb
typo-5.4.2 db/migrate/081_create_cache_informations.rb
typo-5.4.1 db/migrate/081_create_cache_informations.rb
typo-5.4 db/migrate/081_create_cache_informations.rb
typo-5.2.98 db/migrate/081_create_cache_informations.rb
typo-5.3 db/migrate/081_create_cache_informations.rb