Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mbleigh/seed-fu
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.3.3
Choose a base ref
...
head repository: mbleigh/seed-fu
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Dec 22, 2014

  1. Update dependencies for Rails 4.2

    Karolis Mazukna committed Dec 22, 2014
    1

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    0d958e8 View commit details
  2. fix tests for 4.2

    Karolis Mazukna committed Dec 22, 2014
    Copy the full SHA
    38e328b View commit details

Commits on Dec 24, 2014

  1. Merge pull request #87 from Nikamura/master

    Update dependencies for Rails 4.2
    aserafin committed Dec 24, 2014
    Copy the full SHA
    131ccdf View commit details
  2. bump version to 2.3.4

    aserafin committed Dec 24, 2014
    Copy the full SHA
    92ac270 View commit details

Commits on Dec 29, 2014

  1. Copy the full SHA
    25881e3 View commit details

Commits on Mar 5, 2015

  1. Copy the full SHA
    6e96d63 View commit details

Commits on Mar 29, 2015

  1. Merge pull request #92 from y-yagi/rails_4_2_x

    update dependencies for Rails 4.2.x
    aserafin committed Mar 29, 2015
    Copy the full SHA
    ca7f1e6 View commit details
  2. bump version to 2.3.5

    aserafin committed Mar 29, 2015
    3
    Copy the full SHA
    b5b32f0 View commit details
  3. Update CHANGELOG.md

    aserafin committed Mar 29, 2015
    Copy the full SHA
    a13ce36 View commit details

Commits on Nov 10, 2015

  1. removing rails 4 limitation

    Derick Matamoros committed Nov 10, 2015
    Copy the full SHA
    264801c View commit details

Commits on Mar 18, 2016

  1. Merge pull request #99 from cimtico/rails_5

    allow newer rails
    aserafin committed Mar 18, 2016
    Copy the full SHA
    8468169 View commit details
  2. Merge pull request #89 from Valve/remove-implicit-ordering

    Remove implicit ordering when searching existing row by constraint
    aserafin committed Mar 18, 2016
    Copy the full SHA
    2ff039c View commit details

Commits on Mar 22, 2016

  1. add MIT license to gemspec

    fzipi committed Mar 22, 2016
    Copy the full SHA
    f9be330 View commit details

Commits on Apr 18, 2016

  1. Copy the full SHA
    8def918 View commit details

Commits on Jul 1, 2016

  1. Merge pull request #103 from fzipi/add-gemspec-license

    add MIT license to gemspec
    aserafin authored Jul 1, 2016
    Copy the full SHA
    154e6b4 View commit details
  2. allow rails 5 in Gemfile

    aserafin committed Jul 1, 2016
    Copy the full SHA
    bbcb75a View commit details
  3. Copy the full SHA
    61361bf View commit details
  4. Merge pull request #106 from sickate/master

    add PostGIS adapter name detection
    aserafin authored Jul 1, 2016
    Copy the full SHA
    9d393b2 View commit details

Commits on Oct 25, 2017

  1. Support PostgreSQL 10

    ppworks committed Oct 25, 2017
    Copy the full SHA
    66ad1f8 View commit details

Commits on Nov 24, 2017

  1. Merge pull request #121 from ppworks/support-postgresql10

    Support PostgreSQL 10
    aserafin authored Nov 24, 2017
    Copy the full SHA
    52072e7 View commit details
  2. bump version to 2.3.7

    aserafin committed Nov 24, 2017
    Copy the full SHA
    9a5913f View commit details

Commits on Jan 15, 2018

  1. Copy the full SHA
    0ad8e46 View commit details

Commits on Apr 7, 2018

  1. Merge pull request #125 from mnaberez/postgresql_version

    Restore support for PostgreSQL with Rails versions before 5.0.0
    aserafin authored Apr 7, 2018
    Copy the full SHA
    ba11d38 View commit details
  2. bump version to 2.3.9

    aserafin committed Apr 7, 2018
    Copy the full SHA
    34c054c View commit details
Showing with 49 additions and 11 deletions.
  1. +28 −0 CHANGELOG.md
  2. +1 −1 Gemfile
  3. +1 −1 README.md
  4. +15 −6 lib/seed-fu/seeder.rb
  5. +1 −1 lib/seed-fu/version.rb
  6. +3 −2 seed-fu.gemspec
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
Version 2.3.8
-------------

Bug fixes:

* Restored support for PostgreSQL with Rails versions before 5.0.0 broken in Seed Fu 2.3.7.

Version 2.3.7
-------------

Features:

* Postgresql >= 10.0 support

Version 2.3.6
-------------

Features:

* Rails 5.0 support

Version 2.3.5
-------------

Features:

* Rails 4.2 support

Version 2.3.3
-------------

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'http://rubygems.org'
gem 'rails', ">= 3.1", "< 4.1"
gem 'rails', ">= 3.1", "< 5.1"
gemspec
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ Basic Example
Installation
------------

### Rails 3.1, 3.2, 4.0, 4.1
### Rails 3.1, 3.2, 4.0, 4.1, 4.2, 5.0

Just add `gem 'seed-fu', '~> 2.3'` to your `Gemfile`

21 changes: 15 additions & 6 deletions lib/seed-fu/seeder.rb
Original file line number Diff line number Diff line change
@@ -71,12 +71,12 @@ def seed_record(data)
else
record.assign_attributes(data)
end
record.save(:validate => false) || raise(ActiveRecord::RecordNotSaved)
record.save(:validate => false) || raise(ActiveRecord::RecordNotSaved, 'Record not saved!')
record
end

def find_or_initialize_record(data)
@model_class.where(constraint_conditions(data)).first ||
@model_class.where(constraint_conditions(data)).take ||
@model_class.new
end

@@ -85,15 +85,24 @@ def constraint_conditions(data)
end

def update_id_sequence
if @model_class.connection.adapter_name == "PostgreSQL"
if @model_class.connection.adapter_name == "PostgreSQL" or @model_class.connection.adapter_name == "PostGIS"
return if @model_class.primary_key.nil? || @model_class.sequence_name.nil?

quoted_id = @model_class.connection.quote_column_name(@model_class.primary_key)
sequence = @model_class.sequence_name

@model_class.connection.execute <<-EOS
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT increment_by FROM #{sequence}), (SELECT min_value FROM #{sequence})) FROM #{@model_class.quoted_table_name}), false)
EOS
# TODO postgresql_version was made public in Rails 5.0.0, remove #send when support for earlier versions are dropped
if @model_class.connection.send(:postgresql_version) >= 100000
sql =<<-EOS
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT seqincrement FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass), (SELECT seqmin FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass)) FROM #{@model_class.quoted_table_name}), false)
EOS
else
sql =<<-EOS
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT increment_by FROM #{sequence}), (SELECT min_value FROM #{sequence})) FROM #{@model_class.quoted_table_name}), false)
EOS
end

@model_class.connection.execute sql
end
end
end
2 changes: 1 addition & 1 deletion lib/seed-fu/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module SeedFu
# The current version of Seed Fu
VERSION = '2.3.3'
VERSION = '2.3.9'
end
5 changes: 3 additions & 2 deletions seed-fu.gemspec
Original file line number Diff line number Diff line change
@@ -8,14 +8,15 @@ Gem::Specification.new do |s|
s.name = "seed-fu"
s.version = SeedFu::VERSION
s.platform = Gem::Platform::RUBY
s.licenses = ['MIT']
s.authors = ["Michael Bleigh", "Jon Leighton"]
s.email = ["michael@intridea.com", "j@jonathanleighton.com"]
s.homepage = "http://github.com/mbleigh/seed-fu"
s.summary = "Easily manage seed data in your Active Record application"
s.description = "Seed Fu is an attempt to once and for all solve the problem of inserting and maintaining seed data in a database. It uses a variety of techniques gathered from various places around the web and combines them to create what is hopefully the most robust seed data system around."

s.add_dependency "activerecord", [">= 3.1", "< 4.2"]
s.add_dependency "activesupport", [">= 3.1", "< 4.2"]
s.add_dependency "activerecord", [">= 3.1"]
s.add_dependency "activesupport", [">= 3.1"]

s.add_development_dependency "rspec", "~> 2.0"
s.add_development_dependency "pg", '~> 0'