Skip to content

Commit

Permalink
Merge branch 'master' of github.com:anykeyh/clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Yacine Petitprez committed Mar 16, 2018
2 parents a781649 + bd95fa6 commit daabec8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
7 changes: 0 additions & 7 deletions spec/init_pg.sh

This file was deleted.

11 changes: 11 additions & 0 deletions spec/migration/migration_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,15 @@ module MigrationSpec
end
end
end

temporary do
describe "Migration" do
it "can run migrations apply_all multiple times" do
Clear::Migration::Manager.instance.reinit!
# Ensure that multiple migration apply_all's can run without issue
Clear::Migration::Manager.instance.apply_all
Clear::Migration::Manager.instance.apply_all
end
end
end
end
8 changes: 4 additions & 4 deletions spec/model/model_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ module ModelSpec
end
end

Clear::Migration::Manager.instance.reinit!
ModelSpecMigration123.new.apply(Clear::Migration::Direction::UP)
temporary do
Clear::Migration::Manager.instance.reinit!
ModelSpecMigration123.new.apply(Clear::Migration::Direction::UP)

describe "Clear::Model" do
temporary do
describe "Clear::Model" do
context "fields management" do
it "can load from array" do
temporary do
Expand Down
7 changes: 5 additions & 2 deletions src/clear/migration/manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ class Clear::Migration::Manager
ensure_ready

list_of_migrations = @migrations.sort { |a, b| a.uid <=> b.uid }
list_of_migrations.reject! { |x| @migrations_up.includes?(x) }
list_of_migrations.reject! { |x| @migrations_up.includes?(x.uid) }

list_of_migrations.each(&.apply(Clear::Migration::Direction::UP))
list_of_migrations.each do |migration|
migration.apply(Clear::Migration::Direction::UP)
@migrations_up.add(migration.uid)
end
end

#
Expand Down
2 changes: 1 addition & 1 deletion src/clear/model/collection.cr
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ module Clear::Model
end

def [](off) : T
self.[]?(off).not_nil
self.[]?(off).not_nil!
end

def []?(off) : T?
Expand Down

0 comments on commit daabec8

Please sign in to comment.