miguel 0.1.0.pre7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +4 -0
- data/.travis.yml +10 -3
- data/.yardopts +3 -0
- data/Gemfile +2 -0
- data/LICENSE +19 -0
- data/README.md +3 -1
- data/Rakefile +9 -0
- data/lib/miguel/command.rb +42 -30
- data/lib/miguel/importer.rb +50 -37
- data/lib/miguel/schema.rb +7 -7
- data/lib/miguel/version.rb +1 -1
- data/miguel.gemspec +3 -1
- data/test/data/schema.rb +5 -0
- data/test/helper.rb +8 -7
- data/test/test_importer.rb +4 -0
- data/test/test_schema.rb +59 -0
- metadata +36 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a2c18dba8459d1bdfe249763d04a4d423ff3a68c647552e3a1930d4a558820b7
|
4
|
+
data.tar.gz: 2cc0ca7730fd4ce526ccc2b96f59effc2ab78611d9c45392bee4cb3565c8d883
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c64bf876100abd4bad1dd05e0aebd5f4040c497bbff4afce009d60018d52f6238e896d64aac813ccb46aff6b47e82179d77708be775bfca1d80a9eca06e71a6
|
7
|
+
data.tar.gz: abcabe36a6bcb93742611ccd3410702af25850fe49862a70e8e6e8098d545dd195c501d547d322b4a118527c65897669018bd03fbfd61f8bd99ec6920e8e3c48
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -3,11 +3,15 @@
|
|
3
3
|
language: ruby
|
4
4
|
rvm:
|
5
5
|
- ruby-head
|
6
|
-
- 2.
|
7
|
-
- 2.
|
6
|
+
- 2.6.3
|
7
|
+
- 2.5.5
|
8
|
+
- 2.4.6
|
9
|
+
- 2.3.8
|
10
|
+
- 2.2.10
|
11
|
+
- 2.1.10
|
8
12
|
- 2.0.0
|
9
13
|
- 1.9.3
|
10
|
-
- rbx-
|
14
|
+
- rbx-3
|
11
15
|
- jruby-head
|
12
16
|
- jruby-19mode
|
13
17
|
gemfile: .travis.gemfile
|
@@ -15,9 +19,12 @@ env:
|
|
15
19
|
global:
|
16
20
|
# travis encrypt CODECLIMATE_REPO_TOKEN=???
|
17
21
|
secure: WjkizgQWf8gx1KIfPsX99TR6uJgnF9ybHUtu/kz0JHWYNif8IJ7qsO+kCXzdGtTiwMgQL4cHzYqbGa6VAiiPQMmG9NPLZ1Q4STLW9W4afg2lOqQmyGk0iSapEu/YXlWM6kZW4IcY/4BG8DzgfJnzy6+4yWBGZFdMwcpJEVZpy02c3Y6RBsrFJ6wz1BpWZR8bHaFXrLzfpHeS8t8h1OYetf1RLg9MvPvankkoIBBxw6ahV9QhG1O2cXyzlfH30wQA90stTFOybUkJ/hVLlCXyxEbjuhUKTWeU4s/Uw5XhA3k5ll0GWyaTUQU3aSWwTDv2Z/dncwR2y8RMuGJqHVLcTz2jtb+NINncrYq5ybGUaCNpdJea7/OS4R6M9t2VS666j5dPN4tVsTgyAONzgHHEmTYwHk3s9s4EKyoHAl398Kv/dazwSmBasvc1kIDzsi6n83k4MHMSNFTBlA4Jz0LaQ7Qx0hxS7MIsGhDmVeeEOQOw1idof6hQdBCpcLfO9NCxqRFWYAgK99U5mXjqRWBeQGyEwrtgbvyweanDrFfHtVEQpUrW1Do4zNz9jZ+MS43hKViu3loH3y20w8Vi96UXWoDp/RreLGMpM33V3xzCC+U3Ex1Dckoq0TgQ8RFD3U/d0KdQJ02B8C3iRmNqD43jGJEJl5USnT58gwgPumLwoCs=
|
22
|
+
after_success:
|
23
|
+
- bundle exec codeclimate-test-reporter
|
18
24
|
matrix:
|
19
25
|
allow_failures:
|
20
26
|
- rvm: ruby-head
|
27
|
+
- rvm: rbx-3
|
21
28
|
- rvm: jruby-19mode
|
22
29
|
- rvm: jruby-head
|
23
30
|
before_script:
|
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Patrik Rak (patrik@raxoft.cz)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -139,6 +139,8 @@ Finally, the `timestamps` helper can be used to create the
|
|
139
139
|
If you pass the `mysql_timestamps: true` option to `define`,
|
140
140
|
the `update_time` timestamp will have the MySQL auto-update feature enabled,
|
141
141
|
and timestamps will use the `'0000-00-00 00:00:00'` default by default.
|
142
|
+
The latter can be also enabled and disabled explicitly by setting
|
143
|
+
the `zero_timestamps` option to `true` or `false`, respectively.
|
142
144
|
|
143
145
|
## Using the command
|
144
146
|
|
@@ -208,7 +210,7 @@ and adjust the schema description accordingly.
|
|
208
210
|
|
209
211
|
## Credits
|
210
212
|
|
211
|
-
Copyright © 2015 Patrik Rak
|
213
|
+
Copyright © 2015-2019 Patrik Rak
|
212
214
|
|
213
215
|
Miguel is released under the MIT license.
|
214
216
|
|
data/Rakefile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Rake makefile.
|
2
2
|
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
3
5
|
task :default => :test
|
4
6
|
|
5
7
|
desc 'Run tests'
|
@@ -7,4 +9,11 @@ task :test do
|
|
7
9
|
sh "bacon --automatic --quiet"
|
8
10
|
end
|
9
11
|
|
12
|
+
desc 'Run tests with coverage'
|
13
|
+
task :cov do
|
14
|
+
sh "rm -rf coverage"
|
15
|
+
ENV['COVERAGE'] = 'on'
|
16
|
+
Rake::Task[:test].execute
|
17
|
+
end
|
18
|
+
|
10
19
|
# EOF #
|
data/lib/miguel/command.rb
CHANGED
@@ -102,36 +102,48 @@ module Miguel
|
|
102
102
|
# Execute the command itself.
|
103
103
|
def execute( args )
|
104
104
|
command = args.shift or fail "Missing command, use -h to see usage."
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
105
|
+
method = "execute_#{command}"
|
106
|
+
fail "Invalid command, use -h to see usage." unless respond_to?( method, true )
|
107
|
+
check_args( args, method( method ).arity )
|
108
|
+
send( method, *args )
|
109
|
+
end
|
110
|
+
|
111
|
+
# Execute the show command.
|
112
|
+
def execute_show( name )
|
113
|
+
schema = get_schema( name )
|
114
|
+
print schema.dump
|
115
|
+
end
|
116
|
+
|
117
|
+
# Execute the dump command.
|
118
|
+
def execute_dump( name )
|
119
|
+
schema = get_schema( name )
|
120
|
+
show_changes( Schema.new, schema )
|
121
|
+
end
|
122
|
+
|
123
|
+
# Execute the down command.
|
124
|
+
def execute_down( name )
|
125
|
+
schema = get_schema( name )
|
126
|
+
show_changes( schema, Schema.new )
|
127
|
+
end
|
128
|
+
|
129
|
+
# Execute the diff command.
|
130
|
+
def execute_diff( old_name, new_name )
|
131
|
+
old_schema = get_schema( old_name )
|
132
|
+
new_schema = get_schema( new_name )
|
133
|
+
show_changes( old_schema, new_schema )
|
134
|
+
end
|
135
|
+
|
136
|
+
# Execute the apply command.
|
137
|
+
def execute_apply( db_name, name )
|
138
|
+
db = get_db( db_name )
|
139
|
+
schema = get_schema( name )
|
140
|
+
apply_schema( db, schema )
|
141
|
+
end
|
142
|
+
|
143
|
+
# Execute the clear command.
|
144
|
+
def execute_clear( db_name )
|
145
|
+
db = get_db( db_name )
|
146
|
+
apply_schema( db, Schema.new )
|
135
147
|
end
|
136
148
|
|
137
149
|
# Make sure the argument count is as expected.
|
data/lib/miguel/importer.rb
CHANGED
@@ -36,46 +36,50 @@ module Miguel
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
# Convert given database type to type and optional options used by our schema definitions.
|
40
|
-
|
41
|
-
|
39
|
+
# Convert given MySQL database type to type and optional options used by our schema definitions.
|
40
|
+
def revert_mysql_type( type )
|
41
|
+
case type
|
42
|
+
when /\Aint\(\d+\)\z/
|
43
|
+
return :integer, :default_size => 11
|
44
|
+
when /\Aint\(\d+\) unsigned\z/
|
45
|
+
return :integer, :unsigned => true, :default_size => 10
|
46
|
+
when /\Abigint\(\d+\)\z/
|
47
|
+
return :bigint, :default_size => 20
|
48
|
+
when /\Abigint\(\d+\) unsigned\z/
|
49
|
+
return :bigint, :unsigned => true, :default_size => 20
|
50
|
+
when /\Adecimal\(\d+,\d+\)\z/
|
51
|
+
return :decimal, :default_size => [ 10, 0 ]
|
52
|
+
when /\A(enum|set)\((.*)\)\z/
|
53
|
+
return $1.to_sym, :elements => parse_elements( $2 )
|
54
|
+
end
|
55
|
+
end
|
42
56
|
|
43
|
-
|
57
|
+
# Convert given SQLite database type to type and optional options used by our schema definitions.
|
58
|
+
def revert_sqlite_type( type )
|
59
|
+
case type
|
60
|
+
when /\Ainteger UNSIGNED\z/
|
61
|
+
return :integer, :unsigned => true
|
62
|
+
end
|
63
|
+
end
|
44
64
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
when :sqlite
|
60
|
-
case type
|
61
|
-
when /\Ainteger UNSIGNED\z/
|
62
|
-
return :integer, :unsigned => true
|
63
|
-
end
|
64
|
-
when :postgres
|
65
|
-
case type
|
66
|
-
when /\Acharacter varying/
|
67
|
-
return :String, :default_size => 255
|
68
|
-
when /\Acharacter/
|
69
|
-
return :String, :fixed => true, :default_size => 255
|
70
|
-
when /\Atext\z/
|
71
|
-
return :String, :text => true
|
72
|
-
when /\Abytea\z/
|
73
|
-
return :blob
|
74
|
-
when /\Atimestamp/
|
75
|
-
return :timestamp
|
76
|
-
end
|
65
|
+
# Convert given Postgres database type to type and optional options used by our schema definitions.
|
66
|
+
def revert_postgres_type( type )
|
67
|
+
case type
|
68
|
+
when /\Acharacter varying/
|
69
|
+
return :String, :default_size => 255
|
70
|
+
when /\Acharacter/
|
71
|
+
return :String, :fixed => true, :default_size => 255
|
72
|
+
when /\Atext\z/
|
73
|
+
return :String, :text => true
|
74
|
+
when /\Abytea\z/
|
75
|
+
return :blob
|
76
|
+
when /\Atimestamp/
|
77
|
+
return :timestamp
|
77
78
|
end
|
79
|
+
end
|
78
80
|
|
81
|
+
# Convert given generic database type to type and optional options used by our schema definitions.
|
82
|
+
def revert_generic_type( type )
|
79
83
|
case type
|
80
84
|
when /\Avarchar/
|
81
85
|
return :String, :default_size => 255
|
@@ -88,8 +92,17 @@ module Miguel
|
|
88
92
|
when /\A\w+\z/
|
89
93
|
return type.to_sym
|
90
94
|
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Convert given database type to type and optional options used by our schema definitions.
|
98
|
+
# The ruby type provided serves as a hint of what Sequel's idea of the type is.
|
99
|
+
def revert_type_literal_internal( type, ruby_type )
|
100
|
+
return :boolean, :default_size => 1 if ruby_type == :boolean
|
101
|
+
|
102
|
+
method = "revert_#{db.database_type}_type"
|
103
|
+
specific_type = send( method, type ) if respond_to?( method, true )
|
91
104
|
|
92
|
-
ruby_type
|
105
|
+
specific_type || revert_generic_type( type ) || ruby_type
|
93
106
|
end
|
94
107
|
|
95
108
|
# Convert given database type to type and optional options used by our schema definitions.
|
data/lib/miguel/schema.rb
CHANGED
@@ -158,7 +158,7 @@ module Miguel
|
|
158
158
|
# Default options implied for certain types.
|
159
159
|
DEFAULT_OPTS = {
|
160
160
|
:string => { :size => 255, :text => false },
|
161
|
-
:bigint => { :size => 20 },
|
161
|
+
:bigint => { :size => 20, :unsigned => false },
|
162
162
|
:decimal => { :size => [ 10, 0 ] },
|
163
163
|
:integer => { :unsigned => false },
|
164
164
|
:time => { :only_time => true },
|
@@ -302,7 +302,7 @@ module Miguel
|
|
302
302
|
|
303
303
|
# The +method_missing+ doesn't take care of constant like methods (like String :name),
|
304
304
|
# so those have to be defined explicitly for each such supported type.
|
305
|
-
for type in Sequel::Schema::Generator::GENERIC_TYPES
|
305
|
+
for type in (defined?(Sequel::Schema::CreateTableGenerator) ? Sequel::Schema::CreateTableGenerator::GENERIC_TYPES : Sequel::Schema::Generator::GENERIC_TYPES)
|
306
306
|
class_eval( "def #{type}(*args) ; @table.add_definition(:#{type},*args) ; end", __FILE__, __LINE__ )
|
307
307
|
end
|
308
308
|
|
@@ -317,7 +317,7 @@ module Miguel
|
|
317
317
|
# automatically updated, and let the create one to be set manually.
|
318
318
|
# Also, Sequel doesn't currently honor :on_update for column definitions,
|
319
319
|
# so we have to use default literal to make it work. Sigh.
|
320
|
-
timestamp :create_time, :null => false, :default => ZERO_TIME
|
320
|
+
timestamp :create_time, :null => false, :default => ( opts[ :zero_timestamps ] == false ? DEFAULT_TIME : ZERO_TIME )
|
321
321
|
timestamp :update_time, :null => false, :default => Sequel.lit( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP' )
|
322
322
|
else
|
323
323
|
Time :create_time
|
@@ -371,9 +371,9 @@ module Miguel
|
|
371
371
|
end
|
372
372
|
|
373
373
|
# Add foreign key definition.
|
374
|
-
def add_foreign_key( columns, table_name,
|
375
|
-
add_column( :integer, columns,
|
376
|
-
@foreign_keys << ForeignKey.new( columns, table_name,
|
374
|
+
def add_foreign_key( columns, table_name, opts = {} )
|
375
|
+
add_column( opts[:type] || :integer, columns, opts ) unless columns.is_a? Array
|
376
|
+
@foreign_keys << ForeignKey.new( columns, table_name, opts )
|
377
377
|
end
|
378
378
|
|
379
379
|
# Add definition of column, index or foreign key.
|
@@ -580,7 +580,7 @@ module Miguel
|
|
580
580
|
# we have to be careful to turn off the MySQL autoupdate behavior.
|
581
581
|
# That's why we have to set defaults explicitly.
|
582
582
|
|
583
|
-
default_time = opts[ :mysql_timestamps ] ? ZERO_TIME : DEFAULT_TIME
|
583
|
+
default_time = ( opts[ :zero_timestamps ] || ( opts[ :mysql_timestamps ] && opts[ :zero_timestamps ].nil? ) ) ? ZERO_TIME : DEFAULT_TIME
|
584
584
|
set_defaults :Time, :timestamp, :default => default_time
|
585
585
|
set_defaults :Time?, :timestamp, :default => nil
|
586
586
|
|
data/lib/miguel/version.rb
CHANGED
data/miguel.gemspec
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path( '../lib/miguel/version', __FILE__ )
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'miguel'
|
7
|
-
s.version = Miguel::VERSION
|
7
|
+
s.version = Miguel::VERSION
|
8
8
|
s.summary = 'Database migrator and migration generator for Sequel.'
|
9
9
|
s.description = <<EOT
|
10
10
|
This gem makes it easy to create and maintain an up-to-date database schema
|
@@ -21,7 +21,9 @@ EOT
|
|
21
21
|
|
22
22
|
s.required_ruby_version = '>= 1.9.3'
|
23
23
|
s.add_runtime_dependency 'sequel', '~> 4.27'
|
24
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
24
25
|
s.add_development_dependency 'bacon', '~> 1.2'
|
26
|
+
s.add_development_dependency 'simplecov', '~> 0.21'
|
25
27
|
s.add_development_dependency 'sqlite3'
|
26
28
|
s.add_development_dependency 'mysql2'
|
27
29
|
s.add_development_dependency 'pg'
|
data/test/data/schema.rb
CHANGED
@@ -76,6 +76,11 @@ Miguel::Schema.define( use_defaults: false ) do
|
|
76
76
|
index :user_id
|
77
77
|
end
|
78
78
|
|
79
|
+
table :bigint do
|
80
|
+
primary_key :id, type: :bigint
|
81
|
+
foreign_key :bigint_id, :bigint, type: :bigint
|
82
|
+
end if mysql
|
83
|
+
|
79
84
|
table :reuse do
|
80
85
|
primary_key :user_id
|
81
86
|
foreign_key [:user_id], :users
|
data/test/helper.rb
CHANGED
@@ -6,18 +6,19 @@ def jruby?
|
|
6
6
|
defined?( RUBY_ENGINE ) and RUBY_ENGINE == 'jruby'
|
7
7
|
end
|
8
8
|
|
9
|
-
if ENV[ 'COVERAGE' ]
|
10
|
-
require 'simplecov'
|
11
|
-
SimpleCov.start
|
12
|
-
end
|
13
|
-
|
14
9
|
begin
|
15
10
|
require 'codeclimate-test-reporter'
|
16
|
-
CodeClimate::TestReporter.start
|
17
11
|
ENV[ 'COVERAGE' ] = 'on'
|
18
12
|
rescue LoadError
|
19
13
|
end unless jruby?
|
20
14
|
|
15
|
+
if ENV[ 'COVERAGE' ]
|
16
|
+
require 'simplecov'
|
17
|
+
SimpleCov.start do
|
18
|
+
add_filter 'bundler'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
21
22
|
# Setup helpers.
|
22
23
|
|
23
24
|
DATA_DIR = File.expand_path( "#{__FILE__}/../data" )
|
@@ -35,7 +36,7 @@ class Bacon::Context
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def lines( s )
|
38
|
-
s.to_s.lines.map.with_index{ |l, i| "#{i}:#{l.strip}" }
|
39
|
+
s.to_s.lines.map.with_index{ |l, i| "#{i}:#{l.strip}" } << :EOF
|
39
40
|
end
|
40
41
|
|
41
42
|
def match( a, b )
|
data/test/test_importer.rb
CHANGED
@@ -15,6 +15,10 @@ describe Miguel::Importer do
|
|
15
15
|
{},
|
16
16
|
{ unsigned_keys: true },
|
17
17
|
{ mysql_timestamps: true },
|
18
|
+
{ mysql_timestamps: true, zero_timestamps: true },
|
19
|
+
{ mysql_timestamps: true, zero_timestamps: false },
|
20
|
+
{ zero_timestamps: true },
|
21
|
+
{ zero_timestamps: false },
|
18
22
|
]
|
19
23
|
when :postgres
|
20
24
|
[ signed_unsigned: true ]
|
data/test/test_schema.rb
CHANGED
@@ -229,6 +229,65 @@ describe Miguel::Schema do
|
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
|
+
should 'control zero timestamps explicitly' do
|
233
|
+
match_schema <<-EOT, zero_timestamps: false do
|
234
|
+
table :timestamps do
|
235
|
+
timestamp :t1, :null => false, :default => "2000-01-01 00:00:00"
|
236
|
+
timestamp :t2, :null => true, :default => nil
|
237
|
+
timestamp :create_time, :null => false, :default => "2000-01-01 00:00:00"
|
238
|
+
timestamp :update_time, :null => false, :default => "2000-01-01 00:00:00"
|
239
|
+
end
|
240
|
+
EOT
|
241
|
+
table :timestamps do
|
242
|
+
Time :t1
|
243
|
+
Time? :t2
|
244
|
+
timestamps
|
245
|
+
end
|
246
|
+
end
|
247
|
+
match_schema <<-EOT, zero_timestamps: true do
|
248
|
+
table :timestamps do
|
249
|
+
timestamp :t1, :null => false, :default => "0000-00-00 00:00:00"
|
250
|
+
timestamp :t2, :null => true, :default => nil
|
251
|
+
timestamp :create_time, :null => false, :default => "0000-00-00 00:00:00"
|
252
|
+
timestamp :update_time, :null => false, :default => "0000-00-00 00:00:00"
|
253
|
+
end
|
254
|
+
EOT
|
255
|
+
table :timestamps do
|
256
|
+
Time :t1
|
257
|
+
Time? :t2
|
258
|
+
timestamps
|
259
|
+
end
|
260
|
+
end
|
261
|
+
match_schema <<-EOT, mysql_timestamps: true, zero_timestamps: true do
|
262
|
+
table :timestamps do
|
263
|
+
timestamp :t1, :null => false, :default => "0000-00-00 00:00:00"
|
264
|
+
timestamp :t2, :null => true, :default => nil
|
265
|
+
timestamp :create_time, :null => false, :default => "0000-00-00 00:00:00"
|
266
|
+
timestamp :update_time, :null => false, :default => Sequel.lit("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
|
267
|
+
end
|
268
|
+
EOT
|
269
|
+
table :timestamps do
|
270
|
+
Time :t1
|
271
|
+
Time? :t2
|
272
|
+
timestamps
|
273
|
+
end
|
274
|
+
end
|
275
|
+
match_schema <<-EOT, mysql_timestamps: true, zero_timestamps: false do
|
276
|
+
table :timestamps do
|
277
|
+
timestamp :t1, :null => false, :default => "2000-01-01 00:00:00"
|
278
|
+
timestamp :t2, :null => true, :default => nil
|
279
|
+
timestamp :create_time, :null => false, :default => "2000-01-01 00:00:00"
|
280
|
+
timestamp :update_time, :null => false, :default => Sequel.lit("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
|
281
|
+
end
|
282
|
+
EOT
|
283
|
+
table :timestamps do
|
284
|
+
Time :t1
|
285
|
+
Time? :t2
|
286
|
+
timestamps
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
232
291
|
should 'support auto-incrementing primary keys' do
|
233
292
|
match_schema <<-EOT do
|
234
293
|
table :pk do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miguel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrik Rak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.27'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '13.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bacon
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '1.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.21'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.21'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: sqlite3
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,6 +120,9 @@ files:
|
|
92
120
|
- ".gitignore"
|
93
121
|
- ".travis.gemfile"
|
94
122
|
- ".travis.yml"
|
123
|
+
- ".yardopts"
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE
|
95
126
|
- README.md
|
96
127
|
- Rakefile
|
97
128
|
- bin/miguel
|
@@ -144,12 +175,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
175
|
version: 1.9.3
|
145
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
177
|
requirements:
|
147
|
-
- - "
|
178
|
+
- - ">="
|
148
179
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
180
|
+
version: '0'
|
150
181
|
requirements: []
|
151
|
-
|
152
|
-
rubygems_version: 2.4.5.1
|
182
|
+
rubygems_version: 3.0.3.1
|
153
183
|
signing_key:
|
154
184
|
specification_version: 4
|
155
185
|
summary: Database migrator and migration generator for Sequel.
|