activerecord-tidb-adapter 0.1.1 → 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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ad173cdbfab54d867f0116350b372fc06224abb5c3166da8d59dcbe59125d5e
|
4
|
+
data.tar.gz: 03a849590718d9d94f9d59730d51f001050c00ad09d54ba7dcd9470625627dd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86b8d677d14434d8db2c688caf99946bbc8357d729abcdea9c707330f792cd190cebdfd47b7e9305154ed41399fdaf0315b9f5d718217c922c92faecbcaf80d0
|
7
|
+
data.tar.gz: 563c533e208b02539137b94f5b0e4f6939114dacec5a04524e31744bd8267ead0db261d4e04e02c997b3a2d9646959d56c095aa7be72974cbfa67b91f20a9d9c
|
data/Gemfile.lock
CHANGED
@@ -32,6 +32,75 @@ module ActiveRecord
|
|
32
32
|
module ConnectionAdapters
|
33
33
|
class TidbAdapter < Mysql2Adapter
|
34
34
|
ADAPTER_NAME = 'Tidb'
|
35
|
+
|
36
|
+
def supports_savepoints?
|
37
|
+
false
|
38
|
+
end
|
39
|
+
|
40
|
+
def supports_foreign_keys?
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
44
|
+
def supports_bulk_alter?
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
def supports_advisory_locks?
|
49
|
+
false
|
50
|
+
end
|
51
|
+
|
52
|
+
def supports_optimizer_hints?
|
53
|
+
true
|
54
|
+
end
|
55
|
+
|
56
|
+
def supports_json?
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
def supports_index_sort_order?
|
61
|
+
# TODO: check TiDB version
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
65
|
+
def supports_expression_index?
|
66
|
+
true
|
67
|
+
end
|
68
|
+
|
69
|
+
def supports_common_table_expressions?
|
70
|
+
if tidb_version >= '5.1.0'
|
71
|
+
true
|
72
|
+
else
|
73
|
+
false
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def transaction_isolation_levels
|
78
|
+
{
|
79
|
+
read_committed: 'READ COMMITTED',
|
80
|
+
repeatable_read: 'REPEATABLE READ'
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
def initialize(connection, logger, conn_params, config)
|
85
|
+
super(connection, logger, conn_params, config)
|
86
|
+
|
87
|
+
tidb_version_string = query_value('select version()')
|
88
|
+
@tidb_version = tidb_version_string[/TiDB-v([0-9\.]+)/, 1]
|
89
|
+
end
|
90
|
+
|
91
|
+
def tidb_version_string
|
92
|
+
@tidb_version
|
93
|
+
end
|
94
|
+
|
95
|
+
def tidb_version
|
96
|
+
Version.new(tidb_version_string)
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.database_exists?(config)
|
100
|
+
!!ActiveRecord::Base.tidb_connection(config)
|
101
|
+
rescue ActiveRecord::NoDatabaseError
|
102
|
+
false
|
103
|
+
end
|
35
104
|
end
|
36
105
|
end
|
37
106
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-tidb-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hooopo Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- bin/setup
|
58
58
|
- lib/active_record/connection_adapters/tidb/database_tasks.rb
|
59
59
|
- lib/active_record/connection_adapters/tidb/setup.rb
|
60
|
+
- lib/active_record/connection_adapters/tidb/type.rb
|
60
61
|
- lib/active_record/connection_adapters/tidb_adapter.rb
|
61
62
|
- lib/activerecord-tidb-adapter.rb
|
62
63
|
- lib/version.rb
|