real_data_tests 0.3.13 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1ff52aca9c674699aa8e7d5cbe17de0db5860b69f0161b2408a1cd239abeadd
4
- data.tar.gz: f8bdffcbd90e239bbf92cfc4fea32a0025a31d5a80b53e4c92c9db08c3babfa7
3
+ metadata.gz: e7e142b478391e00c15f51378e09dd2b7e1429f8c7d1bdd2bb5d059ae8a968fb
4
+ data.tar.gz: a4464de621782aebfa90bac25e90458e4feca5c1007898d3537d44866a937c7b
5
5
  SHA512:
6
- metadata.gz: cfbfb177889ae4ff86637eaa345c89a64faa9357cab0d0ec87a444b29d092fa1fc4750316d818c8afb5d679204a808abcfb6c71fdb47da53f0fdce43d2ebb156
7
- data.tar.gz: 65c58cc33ef5c68579dd04196a6104d62cd97f3f5d764340bdcbeccbaf69c8181c9dfd6e08812e353ecbf0913467b965b86c3718d928d3abfb80a0be766a8b4a
6
+ metadata.gz: '078fcfb22739b26714d756e10afc54ce10a15b947706f1f8eccee31f65384695b770ea546e69a889c033378fff79d314b1b66c4d86b29b3eab2dbb62e6b93231'
7
+ data.tar.gz: c02a03e895d13a78e75adcf5c8ff5c6d9ea920d91dbaf463dad5e344bbe890e5877cb42385a65aa1f2df5c57b94cb595c96b78279cb9f1f66616e44e9a50a927
@@ -29,26 +29,19 @@ module RealDataTests
29
29
  connection.execute('SET session_replication_role = replica;')
30
30
 
31
31
  begin
32
- # Read the SQL file content
33
32
  sql_content = File.read(dump_path)
34
-
35
- # Split the file into individual statements
36
33
  statements = split_sql_statements(sql_content)
37
34
 
38
- # Execute each statement
39
- statements.each do |statement|
40
- next if statement.strip.empty?
35
+ statements.each_with_index do |statement, index|
41
36
  begin
42
- # Clean up any formatting issues that might cause syntax errors
43
37
  cleaned_statement = clean_sql_statement(statement)
38
+ puts "Executing Statement ##{index + 1}: #{cleaned_statement}" # Debug log
44
39
  connection.execute(cleaned_statement)
45
40
  rescue ActiveRecord::StatementInvalid => e
46
- # Provide detailed error information
47
- raise Error, "Failed to execute SQL statement: #{e.message}\nStatement: #{cleaned_statement}"
41
+ raise Error, "Error executing statement ##{index + 1}: #{e.message}\nSQL: #{cleaned_statement}"
48
42
  end
49
43
  end
50
44
  ensure
51
- # Re-enable foreign key checks
52
45
  connection.execute('SET session_replication_role = DEFAULT;')
53
46
  end
54
47
  end
@@ -95,7 +88,7 @@ module RealDataTests
95
88
  # Add the last statement if it exists
96
89
  statements << current_statement.strip unless current_statement.strip.empty?
97
90
 
98
- # Ensure `ON CONFLICT` stays with the previous statement
91
+ # Normalize `ON CONFLICT` clauses
99
92
  statements = statements.each_with_object([]) do |stmt, result|
100
93
  if stmt.strip.upcase.start_with?('ON CONFLICT')
101
94
  result[-1] = "#{result.last.strip} #{stmt.strip}"
@@ -104,10 +97,10 @@ module RealDataTests
104
97
  end
105
98
  end
106
99
 
107
- # Normalize spacing around `ON CONFLICT` and ensure semicolons
100
+ # Ensure semicolons and spacing
108
101
  statements.map! do |stmt|
109
102
  stmt = stmt.gsub(/\)\s*ON CONFLICT/, ') ON CONFLICT') # Normalize spacing
110
- stmt.strip.end_with?(';') ? stmt.strip : "#{stmt.strip};" # Ensure semicolon
103
+ stmt.strip.end_with?(';') ? stmt.strip : "#{stmt.strip};"
111
104
  end
112
105
 
113
106
  statements
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RealDataTests
4
- VERSION = "0.3.13"
4
+ VERSION = "0.3.14"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real_data_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Dias