Sha256: 2299e1dae884d64699cad00ee15bfac7f4b2e0580d0c04549090f61754deb206

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Middleman
  module Blog
    module Similar
      module Migration
        def self.apply
          ActiveRecord::Schema.define(version: 201703240752) do # rubocop:disable Style/NumericLiterals
            unless ActiveRecord::Base.connection.data_source_exists? 'articles'
              create_table :articles do |table|
                table.column :page_id, :string, index: true, unique: true
                table.column :digest, :string, index: true
              end
            end

            unless ActiveRecord::Base.connection.data_source_exists? 'tags'
              create_table :tags do |table|
                table.column :name, :string, index: true, unique: true
              end
            end

            unless ActiveRecord::Base.connection.data_source_exists? 'taggings'
              create_table :taggings do |table|
                table.references :article, foreign_key: true
                table.references :tag, foreign_key: true
                table.column :weight, :integer, default: 1, null: false
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-blog-similar-2.0.1 lib/middleman-blog-similar/models/migration.rb