usesguid_migrations 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
- = 1.0.0 2009-11-113
1
+ = 1.0.1 2009-12-20
2
+
3
+ * Added add_column override that recognizes the :guid type
4
+
5
+
6
+ = 1.0.0 2009-11-13
2
7
 
3
8
  * Ported from a plugin to Gem
data/README.rdoc CHANGED
@@ -41,6 +41,7 @@ type necessary for usesguid to work correctly.
41
41
 
42
42
  * Automatically generate an id field with correct typing for usesguid
43
43
  * Migration associated method for generating foreign keys with correct typing for usesguid
44
+ * add_column method that recognizes :guid type.
44
45
  * Schema dumper will create schema.rb files with the correct typing for usesguid
45
46
 
46
47
 
@@ -94,6 +95,10 @@ If you run into any issues with running tests or specs, it could be something st
94
95
  file is used to prepare the database for testing. To override this and make migrations be used to prepare the database, copy
95
96
  and rename the testdb.rake.txt file to {project root}/lib/tasks/testdb.rake.
96
97
 
98
+ In order to add a column to a table:
99
+
100
+ add_column :users, :account_id, :guid, :null => false
101
+
97
102
 
98
103
  == INSTALL
99
104
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -9,7 +9,7 @@ require 'usesguid_migrations/active_record_extensions/connection_adapters/schema
9
9
  require 'usesguid_migrations/active_record_extensions/connection_adapters/table_definition'
10
10
 
11
11
  module UsesguidMigrations
12
- VERSION = '1.0.0'
12
+ VERSION = '1.0.1'
13
13
  end
14
14
 
15
15
  ActiveRecord::Base.send( :include, UsesguidMigrations::ActiveRecordExtensions::Base ) if defined?( ActiveRecord::Base )
@@ -6,6 +6,7 @@ module UsesguidMigrations
6
6
  def self.included( base )
7
7
  base.module_eval do
8
8
  alias_method_chain :create_table, :lfe_usesguid_migrations
9
+ alias_method_chain :add_column, :lfe_usesguid_migrations
9
10
  end
10
11
  end
11
12
 
@@ -53,7 +54,14 @@ module UsesguidMigrations
53
54
  end
54
55
  end
55
56
  end
56
-
57
+
58
+ def add_column_with_lfe_usesguid_migrations( table_name, column_name, type, options={} )
59
+ return add_column_without_lfe_usesguid_migrations( table_name, column_name, type, options ) unless type.to_s == 'guid'
60
+
61
+ add_column_sql = "ALTER TABLE #{quote_table_name( table_name )} ADD #{quote_column_name( column_name )} VARCHAR(#{options[:limit] || 22}) BINARY CHARACTER SET latin1 COLLATE latin1_bin"
62
+ add_column_options!( add_column_sql, options )
63
+ execute( add_column_sql )
64
+ end
57
65
  end
58
66
  end
59
67
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{usesguid_migrations}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jason Harrelson"]
12
- s.date = %q{2009-11-13}
12
+ s.date = %q{2009-12-20}
13
13
  s.description = %q{Makes your migrations work with usesguid plugin without explicitly defining the primary key id or foreign keys in migrations.}
14
14
  s.email = %q{jason@lookforwardenterprises.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usesguid_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Harrelson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-13 00:00:00 -06:00
12
+ date: 2009-12-20 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency