Sha256: 74a3268bd13b6a72da246ecf418174db79d823195a8c486bebb8f0241f19dd36

Contents?: true

Size: 1.78 KB

Versions: 7

Compression:

Stored size: 1.78 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true
# Copyright 2016 Liqwyd Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

$LOAD_PATH.push File.expand_path('../../app', __FILE__)

require 'require_all'
require 'logger'
require 'active_record'

ENV['RACK_ENV'] = ENV['RACK_ENV'] || 'development'

require 'cyclid/config'

# Top level module for the core Cyclid code; just stub out to provide the
# bare minimum required to inject data via. the models.
module Cyclid
  class << self
    attr_accessor :logger, :config

    begin
      Cyclid.logger = Logger.new(STDERR)

      config_path = ENV['CYCLID_CONFIG'] || File.join(%w(/ etc cyclid config))
      Cyclid.config = API::Config.new(config_path)
    rescue StandardError => ex
      abort "Failed to initialize: #{ex}"
    end
  end
end

require 'db'

version = (ARGV[0].split('=')[1].to_i if ARGV[0] =~ /VERSION=d+/)

current_version = ActiveRecord::Migrator.current_version

STDERR.puts '*' * 80
STDERR.puts "Current version: #{current_version}"
STDERR.puts '*' * 80

migrations_path = File.expand_path('../../db/migrate', __FILE__)

ActiveRecord::Migration.verbose = true
ActiveRecord::Migrator.migrate(migrations_path, version) do |migration|
  next unless migration.version > current_version
  STDERR.puts "#{migration.name}:#{migration.version}"
  true
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cyclid-0.4.0 bin/cyclid-db-migrate
cyclid-0.3.3 bin/cyclid-db-migrate
cyclid-0.3.2 bin/cyclid-db-migrate
cyclid-0.3.1 bin/cyclid-db-migrate
cyclid-0.3.0 bin/cyclid-db-migrate
cyclid-0.2.5 bin/cyclid-db-migrate
cyclid-0.2.4 bin/cyclid-db-migrate