sequel 2.12.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +62 -0
- data/README.rdoc +3 -3
- data/Rakefile +7 -0
- data/doc/advanced_associations.rdoc +44 -0
- data/doc/release_notes/3.0.0.txt +221 -0
- data/lib/sequel/adapters/amalgalite.rb +208 -0
- data/lib/sequel/adapters/db2.rb +3 -0
- data/lib/sequel/adapters/dbi.rb +9 -0
- data/lib/sequel/adapters/do.rb +0 -4
- data/lib/sequel/adapters/firebird.rb +16 -18
- data/lib/sequel/adapters/informix.rb +5 -3
- data/lib/sequel/adapters/jdbc.rb +24 -20
- data/lib/sequel/adapters/jdbc/h2.rb +15 -4
- data/lib/sequel/adapters/mysql.rb +4 -8
- data/lib/sequel/adapters/odbc.rb +0 -4
- data/lib/sequel/adapters/oracle.rb +0 -4
- data/lib/sequel/adapters/shared/mssql.rb +16 -5
- data/lib/sequel/adapters/shared/mysql.rb +87 -86
- data/lib/sequel/adapters/shared/oracle.rb +92 -3
- data/lib/sequel/adapters/shared/postgres.rb +85 -29
- data/lib/sequel/adapters/shared/progress.rb +8 -3
- data/lib/sequel/adapters/shared/sqlite.rb +53 -23
- data/lib/sequel/adapters/sqlite.rb +4 -7
- data/lib/sequel/adapters/utils/unsupported.rb +3 -3
- data/lib/sequel/connection_pool.rb +18 -25
- data/lib/sequel/core.rb +2 -21
- data/lib/sequel/database.rb +60 -44
- data/lib/sequel/database/schema_generator.rb +26 -31
- data/lib/sequel/database/schema_methods.rb +8 -3
- data/lib/sequel/database/schema_sql.rb +114 -28
- data/lib/sequel/dataset.rb +14 -41
- data/lib/sequel/dataset/convenience.rb +31 -54
- data/lib/sequel/dataset/graph.rb +7 -13
- data/lib/sequel/dataset/sql.rb +43 -54
- data/lib/sequel/extensions/inflector.rb +0 -5
- data/lib/sequel/extensions/schema_dumper.rb +238 -0
- data/lib/sequel/metaprogramming.rb +0 -20
- data/lib/sequel/model.rb +1 -2
- data/lib/sequel/model/base.rb +18 -16
- data/lib/sequel/model/inflections.rb +6 -9
- data/lib/sequel/plugins/caching.rb +0 -6
- data/lib/sequel/plugins/hook_class_methods.rb +1 -1
- data/lib/sequel/sql.rb +2 -0
- data/lib/sequel/version.rb +2 -2
- data/spec/adapters/firebird_spec.rb +35 -8
- data/spec/adapters/mysql_spec.rb +173 -266
- data/spec/adapters/oracle_spec.rb +13 -0
- data/spec/adapters/postgres_spec.rb +127 -227
- data/spec/adapters/sqlite_spec.rb +13 -171
- data/spec/core/connection_pool_spec.rb +15 -4
- data/spec/core/core_sql_spec.rb +14 -170
- data/spec/core/database_spec.rb +50 -132
- data/spec/core/dataset_spec.rb +47 -930
- data/spec/core/expression_filters_spec.rb +12 -0
- data/spec/core/schema_generator_spec.rb +37 -45
- data/spec/core/schema_spec.rb +26 -16
- data/spec/core/spec_helper.rb +0 -25
- data/spec/extensions/inflector_spec.rb +0 -3
- data/spec/extensions/schema_dumper_spec.rb +292 -0
- data/spec/extensions/serialization_spec.rb +9 -0
- data/spec/extensions/single_table_inheritance_spec.rb +6 -1
- data/spec/extensions/spec_helper.rb +1 -3
- data/spec/extensions/validation_helpers_spec.rb +4 -4
- data/spec/integration/database_test.rb +18 -0
- data/spec/integration/dataset_test.rb +112 -1
- data/spec/integration/eager_loader_test.rb +70 -9
- data/spec/integration/prepared_statement_test.rb +2 -2
- data/spec/integration/schema_test.rb +76 -27
- data/spec/integration/spec_helper.rb +0 -14
- data/spec/integration/transaction_test.rb +27 -0
- data/spec/model/associations_spec.rb +0 -36
- data/spec/model/base_spec.rb +18 -123
- data/spec/model/hooks_spec.rb +2 -235
- data/spec/model/inflector_spec.rb +15 -115
- data/spec/model/model_spec.rb +0 -120
- data/spec/model/plugins_spec.rb +0 -70
- data/spec/model/record_spec.rb +35 -93
- data/spec/model/spec_helper.rb +0 -27
- data/spec/model/validations_spec.rb +0 -931
- metadata +9 -14
- data/lib/sequel/deprecated.rb +0 -593
- data/lib/sequel/deprecated_migration.rb +0 -91
- data/lib/sequel/model/deprecated.rb +0 -204
- data/lib/sequel/model/deprecated_hooks.rb +0 -103
- data/lib/sequel/model/deprecated_inflector.rb +0 -335
- data/lib/sequel/model/deprecated_validations.rb +0 -388
- data/spec/core/core_ext_spec.rb +0 -156
- data/spec/core/migration_spec.rb +0 -263
- data/spec/core/pretty_table_spec.rb +0 -58
- data/spec/model/caching_spec.rb +0 -217
- data/spec/model/schema_spec.rb +0 -92
data/spec/model/schema_spec.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "spec_helper")
|
2
|
-
|
3
|
-
describe Sequel::Model, "table_exists?" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
MODEL_DB.reset
|
7
|
-
@model = Class.new(Sequel::Model(:items))
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should get the table name and question the model's db if table_exists?" do
|
11
|
-
@model.should_receive(:table_name).and_return(:items)
|
12
|
-
@model.db.should_receive(:table_exists?)
|
13
|
-
@model.table_exists?
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
describe Sequel::Model, "create_table and schema" do
|
19
|
-
|
20
|
-
before(:each) do
|
21
|
-
MODEL_DB.reset
|
22
|
-
deprec do
|
23
|
-
@model = Class.new(Sequel::Model) do
|
24
|
-
set_schema(:items) do
|
25
|
-
text :name
|
26
|
-
float :price, :null => false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
deprec_specify "should get the create table SQL list from the db and execute it line by line" do
|
33
|
-
@model.create_table
|
34
|
-
MODEL_DB.sqls.should == ['CREATE TABLE items (name text, price float NOT NULL)']
|
35
|
-
end
|
36
|
-
|
37
|
-
deprec_specify "should reload the schema from the database" do
|
38
|
-
schem = {:name=>{:type=>:string}, :price=>{:type=>:float}}
|
39
|
-
@model.db.should_receive(:schema).with(:items, :reload=>true).and_return(schem.to_a.sort_by{|x| x[0].to_s})
|
40
|
-
@model.create_table
|
41
|
-
@model.db_schema.should == schem
|
42
|
-
@model.instance_variable_get(:@columns).should == [:name, :price]
|
43
|
-
end
|
44
|
-
|
45
|
-
deprec_specify "should return the schema generator via schema" do
|
46
|
-
@model.schema.should be_a_kind_of(Sequel::Schema::Generator)
|
47
|
-
end
|
48
|
-
|
49
|
-
deprec_specify "should use the superclasses schema if it exists" do
|
50
|
-
@submodel = Class.new(@model)
|
51
|
-
@submodel.schema.should be_a_kind_of(Sequel::Schema::Generator)
|
52
|
-
end
|
53
|
-
|
54
|
-
deprec_specify "should return nil if no schema is present" do
|
55
|
-
@model = Class.new(Sequel::Model)
|
56
|
-
@model.schema.should == nil
|
57
|
-
@submodel = Class.new(@model)
|
58
|
-
@submodel.schema.should == nil
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe Sequel::Model, "drop_table" do
|
63
|
-
|
64
|
-
before(:each) do
|
65
|
-
MODEL_DB.reset
|
66
|
-
@model = Class.new(Sequel::Model(:items))
|
67
|
-
end
|
68
|
-
|
69
|
-
deprec_specify "should get the drop table SQL for the associated table and then execute the SQL." do
|
70
|
-
@model.should_receive(:table_name).and_return(:items)
|
71
|
-
@model.db.should_receive(:drop_table_sql).with(:items)
|
72
|
-
@model.db.should_receive(:execute).and_return(:true)
|
73
|
-
@model.drop_table
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
describe Sequel::Model, "create_table!" do
|
79
|
-
|
80
|
-
before(:each) do
|
81
|
-
MODEL_DB.reset
|
82
|
-
@model = Class.new(Sequel::Model(:items))
|
83
|
-
end
|
84
|
-
|
85
|
-
deprec_specify "should drop table if it exists and then create the table" do
|
86
|
-
@model.should_receive(:drop_table).and_return(true)
|
87
|
-
@model.should_receive(:create_table).and_return(true)
|
88
|
-
|
89
|
-
@model.create_table!
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|