baza 0.0.38 → 0.0.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -14
  3. data/lib/baza/database.rb +1 -1
  4. data/lib/baza/db.rb +5 -4
  5. data/lib/baza/driver/active_record/columns.rb +2 -2
  6. data/lib/baza/driver/active_record/commands.rb +2 -2
  7. data/lib/baza/driver/active_record/databases.rb +2 -2
  8. data/lib/baza/driver/active_record/foreign_keys.rb +13 -0
  9. data/lib/baza/driver/active_record/indexes.rb +2 -2
  10. data/lib/baza/driver/active_record/tables.rb +3 -3
  11. data/lib/baza/driver/active_record/users.rb +2 -2
  12. data/lib/baza/driver/active_record.rb +3 -1
  13. data/lib/baza/driver/mysql/columns.rb +1 -1
  14. data/lib/baza/driver/mysql/database.rb +11 -38
  15. data/lib/baza/driver/mysql/foreign_key.rb +2 -0
  16. data/lib/baza/driver/mysql/foreign_keys.rb +13 -0
  17. data/lib/baza/driver/mysql/sql/column.rb +3 -2
  18. data/lib/baza/driver/mysql/sql/create_table.rb +11 -0
  19. data/lib/baza/driver/mysql/table.rb +43 -4
  20. data/lib/baza/driver/mysql/tables.rb +22 -9
  21. data/lib/baza/driver/mysql2/foreign_keys.rb +2 -0
  22. data/lib/baza/driver/mysql2.rb +6 -5
  23. data/lib/baza/driver/mysql_java.rb +2 -2
  24. data/lib/baza/driver/pg/columns.rb +1 -1
  25. data/lib/baza/driver/pg/create_index_sql_creator.rb +2 -5
  26. data/lib/baza/driver/pg/database.rb +2 -2
  27. data/lib/baza/driver/pg/foreign_key.rb +2 -0
  28. data/lib/baza/driver/pg/foreign_keys.rb +13 -0
  29. data/lib/baza/driver/pg/result.rb +5 -1
  30. data/lib/baza/driver/pg/table.rb +43 -0
  31. data/lib/baza/driver/pg/tables.rb +20 -13
  32. data/lib/baza/driver/sqlite3/columns.rb +1 -1
  33. data/lib/baza/driver/sqlite3/foreign_key.rb +14 -0
  34. data/lib/baza/driver/sqlite3/foreign_keys.rb +11 -0
  35. data/lib/baza/driver/sqlite3/table.rb +41 -6
  36. data/lib/baza/driver/sqlite3/tables.rb +15 -14
  37. data/lib/baza/driver/sqlite3.rb +1 -1
  38. data/lib/baza/driver/sqlite3_java.rb +1 -1
  39. data/lib/baza/driver/sqlite3_rhodes.rb +1 -1
  40. data/lib/baza/dump.rb +3 -2
  41. data/lib/baza/foreign_key.rb +1 -1
  42. data/lib/baza/jdbc_driver.rb +1 -1
  43. data/lib/baza/mysql_base_driver.rb +1 -1
  44. data/lib/baza/query_buffer.rb +36 -6
  45. data/lib/baza/result_base.rb +2 -5
  46. data/lib/baza/tables.rb +1 -1
  47. metadata +26 -269
  48. data/.document +0 -5
  49. data/.github/dependabot.yml +0 -13
  50. data/.rspec +0 -1
  51. data/.rubocop.yml +0 -84
  52. data/.rubocop_todo.yml +0 -39
  53. data/.ruby-version +0 -1
  54. data/Gemfile +0 -32
  55. data/Gemfile.lock +0 -164
  56. data/VERSION +0 -1
  57. data/baza.gemspec +0 -264
  58. data/config/best_project_practice_rubocop.yml +0 -10
  59. data/config/best_project_practice_rubocop_todo.yml +0 -163
  60. data/peak_flow.yml +0 -31
  61. data/spec/active_record/models/user.rb +0 -3
  62. data/spec/baza/cloner_spec.rb +0 -10
  63. data/spec/baza/sql_queries/generic_insert_spec.rb +0 -26
  64. data/spec/baza/sql_queries/select_spec.rb +0 -38
  65. data/spec/drivers/active_record_mysql2_spec.rb +0 -22
  66. data/spec/drivers/active_record_mysql_spec.rb +0 -19
  67. data/spec/drivers/active_record_pg_spec.rb +0 -22
  68. data/spec/drivers/active_record_sqlite3_spec.rb +0 -18
  69. data/spec/drivers/mysql2_spec.rb +0 -19
  70. data/spec/drivers/mysql_spec.rb +0 -58
  71. data/spec/drivers/pg/columns_spec.rb +0 -45
  72. data/spec/drivers/pg/table_spec.rb +0 -20
  73. data/spec/drivers/pg_spec.rb +0 -20
  74. data/spec/drivers/sqlite3_spec.rb +0 -67
  75. data/spec/drivers/tiny_spec.rb +0 -27
  76. data/spec/info_active_record_example.rb +0 -35
  77. data/spec/info_active_record_mysql2_example.rb +0 -36
  78. data/spec/info_active_record_mysql2_peak_flow.rb +0 -36
  79. data/spec/info_active_record_mysql_example.rb +0 -37
  80. data/spec/info_active_record_mysql_peak_flow.rb +0 -37
  81. data/spec/info_active_record_pg_example.rb +0 -36
  82. data/spec/info_active_record_pg_peak_flow.rb +0 -36
  83. data/spec/info_active_record_sqlite3.rb +0 -29
  84. data/spec/info_mysql2_example.rb +0 -21
  85. data/spec/info_mysql2_peak_flow.rb +0 -21
  86. data/spec/info_mysql_example.rb +0 -21
  87. data/spec/info_mysql_peak_flow.rb +0 -21
  88. data/spec/info_pg_example.rb +0 -22
  89. data/spec/info_pg_peak_flow.rb +0 -22
  90. data/spec/info_sqlite3.rb +0 -19
  91. data/spec/spec_helper.rb +0 -18
  92. data/spec/support/driver_active_record_collection.rb +0 -62
  93. data/spec/support/driver_collection.rb +0 -396
  94. data/spec/support/driver_columns_collection.rb +0 -64
  95. data/spec/support/driver_databases_collection.rb +0 -48
  96. data/spec/support/driver_foreign_keys_collection.rb +0 -54
  97. data/spec/support/driver_importer_collection.rb +0 -38
  98. data/spec/support/driver_indexes_collection.rb +0 -66
  99. data/spec/support/driver_tables_collection.rb +0 -116
  100. data/spec/support/driver_users_collection.rb +0 -53
@@ -119,6 +119,49 @@ class Baza::Driver::Pg::Table < Baza::Table
119
119
  result
120
120
  end
121
121
 
122
+ def referenced_foreign_keys(args = {})
123
+ sql = "
124
+ SELECT
125
+ tc.constraint_name,
126
+ tc.table_name,
127
+ kcu.column_name,
128
+ ccu.table_name AS foreign_table_name,
129
+ ccu.column_name AS foreign_column_name
130
+
131
+ FROM
132
+ information_schema.table_constraints AS tc
133
+
134
+ JOIN information_schema.key_column_usage AS kcu ON
135
+ tc.constraint_name = kcu.constraint_name
136
+
137
+ JOIN information_schema.constraint_column_usage AS ccu
138
+ ON ccu.constraint_name = tc.constraint_name
139
+
140
+ WHERE
141
+ constraint_type = 'FOREIGN KEY' AND
142
+ ccu.table_name = '#{@db.escape(name)}'
143
+ "
144
+
145
+ sql << " AND tc.constraint_name = '#{@db.escape(args.fetch(:name))}'" if args[:name]
146
+
147
+ result = [] unless block_given?
148
+
149
+ @db.query(sql) do |data|
150
+ foreign_key = Baza::Driver::Pg::ForeignKey.new(
151
+ db: @db,
152
+ data: data
153
+ )
154
+
155
+ if block_given?
156
+ yield foreign_key
157
+ else
158
+ result << foreign_key
159
+ end
160
+ end
161
+
162
+ result
163
+ end
164
+
122
165
  def foreign_key(name)
123
166
  foreign_keys(name: name) do |foreign_key|
124
167
  return foreign_key
@@ -39,39 +39,46 @@ class Baza::Driver::Pg::Tables < Baza::Tables
39
39
  tables_list
40
40
  end
41
41
 
42
- def create(table_name, data, args = nil)
42
+ def create(table_name, columns:, indexes: nil, return_sql: false, temp: false)
43
43
  table_name = table_name.to_s
44
44
  raise "Invalid table name: #{table_name}" if table_name.strip.empty?
45
- raise "No columns was given for '#{table_name}'." if !data[:columns] || data[:columns].empty?
45
+ raise "No columns was given for '#{table_name}'." if !columns || columns.empty?
46
46
 
47
47
  create_table_sql = "CREATE"
48
- create_table_sql << " TEMPORARY" if data[:temp]
48
+ create_table_sql << " TEMPORARY" if temp
49
49
  create_table_sql << " TABLE #{db.quote_table(table_name)} ("
50
50
 
51
51
  first = true
52
- data.fetch(:columns).each do |col_data|
52
+ columns.each do |col_data|
53
53
  create_table_sql << ", " unless first
54
54
  first = false if first
55
55
  col_data.delete(:after) if col_data[:after]
56
56
  create_table_sql << db.columns.data_sql(col_data)
57
57
  end
58
58
 
59
+ columns.each do |col_data| # rubocop :disable Style/CombinableLoops
60
+ next unless col_data.key?(:foreign_key)
61
+
62
+ create_table_sql << ","
63
+ create_table_sql << " CONSTRAINT #{col_data.fetch(:foreign_key).fetch(:name)}" if col_data.fetch(:foreign_key)[:name]
64
+ create_table_sql << " FOREIGN KEY (#{col_data.fetch(:name)}) " \
65
+ "REFERENCES #{col_data.fetch(:foreign_key).fetch(:to).fetch(0)} (#{col_data.fetch(:foreign_key).fetch(:to).fetch(1)})"
66
+ end
67
+
59
68
  create_table_sql << ")"
60
69
 
61
70
  sqls = [create_table_sql]
62
71
 
63
- if data[:indexes] && !data[:indexes].empty?
64
- sqls += db.indexes.create_index(data.fetch(:indexes), table_name: table_name, return_sql: true)
72
+ if indexes && !indexes.empty?
73
+ sqls += db.indexes.create_index(indexes, table_name: table_name, return_sql: true)
65
74
  end
66
75
 
67
- if !args || !args[:return_sql]
68
- db.transaction do
69
- sqls.each do |sql|
70
- db.query(sql)
71
- end
76
+ return sqls if return_sql
77
+
78
+ db.transaction do
79
+ sqls.each do |sql|
80
+ db.query(sql)
72
81
  end
73
- else
74
- sqls
75
82
  end
76
83
  end
77
84
  end
@@ -7,7 +7,7 @@ class Baza::Driver::Sqlite3::Columns
7
7
  @db = args.fetch(:db)
8
8
  end
9
9
 
10
- DATA_SQL_ALLOWED_KEYS = [:name, :type, :maxlength, :autoincr, :primarykey, :null, :default, :default_func, :renames, :after, :renames].freeze
10
+ DATA_SQL_ALLOWED_KEYS = [:foreign_key, :name, :type, :maxlength, :autoincr, :primarykey, :null, :default, :default_func, :renames, :after, :renames].freeze
11
11
  # Returns SQL for a knjdb-compatible hash.
12
12
  def data_sql(data)
13
13
  data.each_key do |key|
@@ -0,0 +1,14 @@
1
+ class Baza::Driver::Sqlite3::ForeignKey < Baza::ForeignKey
2
+ def initialize(db:, data:)
3
+ @db = db
4
+ @column_name = data.fetch(:from)
5
+ @name = data.fetch(:id)
6
+ @table_name = data.fetch(:table)
7
+ @referenced_table_name = data.fetch(:referenced_table)
8
+ @referenced_column_name = data.fetch(:to)
9
+ end
10
+
11
+ def drop
12
+ raise "stub"
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ class Baza::Driver::Sqlite3::ForeignKeys
2
+ attr_reader :db
3
+
4
+ def initialize(db:)
5
+ @db = db
6
+ end
7
+
8
+ def create(from:, to:, name: nil) # rubocop:disable Lint/UnusedMethodArgument
9
+ raise "Only support doing create table in SQLite"
10
+ end
11
+ end
@@ -1,4 +1,4 @@
1
- class Baza::Driver::Sqlite3::Table < Baza::Table
1
+ class Baza::Driver::Sqlite3::Table < Baza::Table # rubocop:disable Metrics/ClassLength
2
2
  attr_reader :name, :type
3
3
 
4
4
  def initialize(args)
@@ -12,6 +12,41 @@ class Baza::Driver::Sqlite3::Table < Baza::Table
12
12
  @indexes_list = Wref::Map.new
13
13
  end
14
14
 
15
+ def foreign_keys
16
+ db.query("PRAGMA foreign_key_list('#{name}')").map do |foreign_key_data|
17
+ data = foreign_key_data.clone
18
+ data[:referenced_table] = data.fetch(:table)
19
+ data[:table] = name
20
+
21
+ Baza::Driver::Sqlite3::ForeignKey.new(db: db, data: data)
22
+ end
23
+ end
24
+
25
+ def referenced_foreign_keys
26
+ sql = "
27
+ SELECT
28
+ sqlite_master.name,
29
+ pragma_join.*
30
+
31
+ FROM
32
+ sqlite_master
33
+
34
+ JOIN pragma_foreign_key_list(sqlite_master.name) pragma_join ON
35
+ pragma_join.\"table\" != sqlite_master.name
36
+
37
+ WHERE sqlite_master.type = 'table'
38
+ ORDER BY sqlite_master.name
39
+ "
40
+
41
+ db.query(sql).map do |foreign_key_data|
42
+ data = foreign_key_data.clone
43
+ data[:referenced_table] = data.fetch(:table)
44
+ data[:table] = data.fetch(:name)
45
+
46
+ Baza::Driver::Sqlite3::ForeignKey.new(db: db, data: data)
47
+ end
48
+ end
49
+
15
50
  def maxlength
16
51
  @data.fetch(:maxlength)
17
52
  end
@@ -57,20 +92,20 @@ class Baza::Driver::Sqlite3::Table < Baza::Table
57
92
  @tables.add_to_list(self)
58
93
 
59
94
  # Rename table on all columns and indexes.
60
- @list.each do |_name, column|
95
+ @list.each_value do |column|
61
96
  column.args[:table_name] = newname
62
97
  end
63
98
 
64
- @indexes_list.each do |_name, index|
99
+ @indexes_list.each_value do |index|
65
100
  index.args[:table_name] = newname
66
101
  end
67
102
  end
68
103
 
69
104
  # Drops the table and creates it again
70
105
  def truncate
71
- table_data = data
106
+ table_data = data.clone
72
107
  drop
73
- @db.tables.create(table_data.delete(:name), table_data)
108
+ @db.tables.create(table_data.delete(:name), **table_data)
74
109
  self
75
110
  end
76
111
 
@@ -149,7 +184,7 @@ class Baza::Driver::Sqlite3::Table < Baza::Table
149
184
 
150
185
  sql = "INSERT INTO `#{self.name}` SELECT "
151
186
  first = true
152
- cols_cur.each do |name, _col|
187
+ cols_cur.each_key do |name|
153
188
  sql << ", " unless first
154
189
  first = false if first
155
190
 
@@ -75,42 +75,43 @@ class Baza::Driver::Sqlite3::Tables < Baza::Tables
75
75
  @list[table.name] = table
76
76
  end
77
77
 
78
- CREATE_ALLOWED_KEYS = [:indexes, :columns].freeze
79
- def create(name, data, args = nil)
80
- data.each_key do |key|
81
- raise "Invalid key: '#{key}' (#{key.class.name})." unless CREATE_ALLOWED_KEYS.include?(key)
82
- end
83
-
84
- raise "No columns given" if data.fetch(:columns).empty?
78
+ def create(name, columns:, indexes: nil, return_sql: false)
79
+ raise "No columns given" if !columns || columns.empty?
85
80
 
86
81
  sql = "CREATE TABLE `#{name}` ("
87
82
 
88
83
  first = true
89
- data.fetch(:columns).each do |col_data|
84
+ columns.each do |col_data|
90
85
  sql << ", " unless first
91
86
  first = false if first
92
87
  sql << @db.columns.data_sql(col_data)
93
88
  end
94
89
 
90
+ columns.each do |col_data| # rubocop:disable Style/CombinableLoops
91
+ next unless col_data.key?(:foreign_key)
92
+
93
+ sql << ", FOREIGN KEY (#{col_data.fetch(:name)}) REFERENCES #{col_data.fetch(:foreign_key).fetch(:to).fetch(0)}(#{col_data.fetch(:foreign_key).fetch(:to).fetch(1)})"
94
+ end
95
+
95
96
  sql << ")"
96
97
 
97
- if args && args[:return_sql]
98
+ if return_sql
98
99
  ret = [sql]
99
100
  else
100
101
  @db.query(sql)
101
102
  end
102
103
 
103
- if data[:indexes]
104
+ if indexes
104
105
  table_obj = self[name]
105
106
 
106
- if args && args[:return_sql]
107
- ret += table_obj.create_indexes(data.fetch(:indexes), return_sql: true)
107
+ if return_sql
108
+ ret += table_obj.create_indexes(indexes, return_sql: true)
108
109
  else
109
- table_obj.create_indexes(data.fetch(:indexes))
110
+ table_obj.create_indexes(indexes)
110
111
  end
111
112
  end
112
113
 
113
- if args && args[:return_sql]
114
+ if return_sql
114
115
  return ret
115
116
  else
116
117
  return nil
@@ -69,7 +69,7 @@ class Baza::Driver::Sqlite3 < Baza::BaseSqlDriver
69
69
  def escape(string)
70
70
  # This code is taken directly from the documentation so we dont have to rely on the SQLite3::Database class. This way it can also be used with JRuby and IronRuby...
71
71
  # http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html
72
- string.to_s.gsub(/'/, "''")
72
+ string.to_s.gsub("'", "''")
73
73
  end
74
74
 
75
75
  # Closes the connection to the database.
@@ -50,7 +50,7 @@ class Baza::Driver::Sqlite3Java < Baza::JdbcDriver
50
50
  def escape(string)
51
51
  # This code is taken directly from the documentation so we dont have to rely on the SQLite3::Database class. This way it can also be used with JRuby and IronRuby...
52
52
  # http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html
53
- string.to_s.gsub(/'/, "''")
53
+ string.to_s.gsub("'", "''")
54
54
  end
55
55
 
56
56
  def transaction
@@ -45,7 +45,7 @@ class Baza::Driver::Sqlite3Rhodes < Baza::BaseSqlDriver
45
45
  def escape(string)
46
46
  # This code is taken directly from the documentation so we dont have to rely on the SQLite3::Database class. This way it can also be used with JRuby and IronRuby...
47
47
  # http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html
48
- string.to_s.gsub(/'/, "''")
48
+ string.to_s.gsub("'", "''")
49
49
  end
50
50
 
51
51
  # Closes the connection to the database.
data/lib/baza/dump.rb CHANGED
@@ -67,11 +67,12 @@ class Baza::Dump
67
67
 
68
68
  # Dumps the given table into the given IO.
69
69
  def dump_table(io, table_obj)
70
- create_data = table_obj.data
70
+ create_data = table_obj.data.clone
71
71
  create_data.delete(:name)
72
+ create_data[:return_sql] = true
72
73
 
73
74
  # Get SQL for creating table and add it to IO.
74
- sqls = @export_db.tables.create(table_obj.name, create_data, return_sql: true)
75
+ sqls = @export_db.tables.create(table_obj.name, **create_data)
75
76
  sqls.each do |sql|
76
77
  io.write("#{sql};\n")
77
78
  end
@@ -1,7 +1,7 @@
1
1
  class Baza::ForeignKey
2
2
  include Baza::DatabaseModelFunctionality
3
3
 
4
- attr_reader :column_name, :db, :name, :table_name
4
+ attr_reader :column_name, :db, :name, :table_name, :referenced_column_name, :referenced_table_name
5
5
 
6
6
  def column
7
7
  @_column ||= table.column(column_name)
@@ -49,7 +49,7 @@ private
49
49
  def query_with_statement(sql, preload_results)
50
50
  @mutex.synchronize do
51
51
  begin
52
- if sql =~ /^\s*(delete|update|create|drop|insert\s+into|alter|truncate)\s+/i
52
+ if sql.match?(/^\s*(delete|update|create|drop|insert\s+into|alter|truncate)\s+/i)
53
53
  return query_no_result_set(sql)
54
54
  else
55
55
  stmt = yield
@@ -62,7 +62,7 @@ class Baza::MysqlBaseDriver < Baza::BaseSqlDriver
62
62
  sql << @db.quote_value(val)
63
63
  end
64
64
  else
65
- hash.each do |_key, val|
65
+ hash.each_value do |val|
66
66
  if first_key
67
67
  first_key = false
68
68
  else
@@ -2,6 +2,8 @@
2
2
  class Baza::QueryBuffer
3
3
  attr_reader :thread_async
4
4
 
5
+ QUERIES_FLUSH_SIZE = 12 * 1024 * 1024
6
+
5
7
  INITIALIZE_ARGS_ALLOWED = [:db, :debug, :flush_async].freeze
6
8
  # Constructor. Takes arguments to be used and a block.
7
9
  def initialize(args)
@@ -10,6 +12,7 @@ class Baza::QueryBuffer
10
12
  @queries = []
11
13
  @inserts = {}
12
14
  @queries_count = 0
15
+ @queries_size = 0
13
16
  @debug = @args[:debug]
14
17
  @lock = Mutex.new
15
18
 
@@ -44,9 +47,10 @@ class Baza::QueryBuffer
44
47
  STDOUT.print "Adding to buffer: #{str}\n" if @debug
45
48
  @queries << str
46
49
  @queries_count += 1
50
+ @queries_size += str.bytesize
47
51
  end
48
52
 
49
- flush if @queries_count >= 1000
53
+ flush if @queries_count >= 1000 || @queries_size >= QUERIES_FLUSH_SIZE
50
54
  nil
51
55
  end
52
56
 
@@ -84,6 +88,27 @@ class Baza::QueryBuffer
84
88
  nil
85
89
  end
86
90
 
91
+ def insert_with_multi(table, data, sort: false)
92
+ data_key = ""
93
+
94
+ if sort
95
+ data = data.sort_by { |element| element[0].to_s }
96
+ data = Hash[data]
97
+ end
98
+
99
+ data.each do |key, value|
100
+ data_key << "#{key}---"
101
+ @queries_size += value.is_a?(String) ? value.bytesize * 1.5 : 8
102
+ end
103
+
104
+ @inserts[table] ||= {}
105
+ @inserts[table][data_key] ||= []
106
+ @inserts[table][data_key] << data
107
+
108
+ @queries_count += 1
109
+ flush if @queries_count >= 1000 || @queries_size >= QUERIES_FLUSH_SIZE
110
+ end
111
+
87
112
  # Flushes all queries out in a transaction. This will automatically be called for every 1000 queries.
88
113
  def flush
89
114
  if @args[:flush_async]
@@ -127,20 +152,25 @@ private
127
152
  @queries.shift(1000).each do |str|
128
153
  STDOUT.print "Executing via buffer: #{str}\n" if @debug
129
154
  db.q(str)
155
+
156
+ @queries_count -= 1
130
157
  end
131
158
  end
132
159
  end
133
160
  end
134
161
 
135
- @inserts.each do |table, datas_arr|
136
- until datas_arr.empty?
137
- datas_chunk_arr = datas_arr.shift(1000)
138
- @db.insert_multi(table, datas_chunk_arr)
162
+ @inserts.each do |table, datas|
163
+ datas.each_value do |datas_arr|
164
+ until datas_arr.empty?
165
+ datas_chunk_arr = datas_arr.shift(1000)
166
+ @db.insert_multi(table, datas_chunk_arr)
167
+ @queries_count -= datas_chunk_arr.length
168
+ end
139
169
  end
140
170
  end
141
171
 
142
172
  @inserts.clear
143
- @queries_count = 0
173
+ @queries_size = 0
144
174
  end
145
175
 
146
176
  nil
@@ -15,11 +15,8 @@ class Baza::ResultBase
15
15
  end
16
16
 
17
17
  def to_a
18
- array = []
19
- each do |row_data|
20
- array << row_data
18
+ map do |row_data|
19
+ row_data
21
20
  end
22
-
23
- array
24
21
  end
25
22
  end
data/lib/baza/tables.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Baza::Tables
2
2
  def exists?(name)
3
- list.any? { |table| table.name.to_s == name.to_s }
3
+ list(name: name).any? { |table| table.name.to_s == name.to_s }
4
4
  end
5
5
  end