fixture_bot 0.4.0 → 0.5.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: 5cab0a5ae780641030baa4e1e03344c11ae2c0b1335ba13d1811585dd0509425
4
- data.tar.gz: 248ad2e7a4a6e50ea530d6f61087d27e30f5ddeaf68ce9e4f180bf3650ac35a1
3
+ metadata.gz: c090d89db0fe2e63c56401037ff83f750698a65da7f0dcb8757636771e5bfccb
4
+ data.tar.gz: fc46b4fc5ed110c42e5fd12299759d5f31fee318d927e401b0567b2ceed75409
5
5
  SHA512:
6
- metadata.gz: a9694e1cf5be46e6252e1c33fa36fbefb6e41f99ad7053355d4f5018540b130706b24fe1d971563068aa52328777abf69f7ea096c90c66ac22416dadde2bfd79
7
- data.tar.gz: 8139af34d100047717de35b6c7595721f00138c76a802dac728d11ab78f4d797bbbc0eb7c2f050bb120a67b52d05f34eb278a3c86727ecccf9c769176daa1ebd
6
+ metadata.gz: 27e0ef47c063f9600e4844bf8e45025505bf46899eb1c99d1d5ae2527b4f674f75a1d903f8b24fda7d52a11a19b10e395f3dbe210d179e2750ccc749c32a1993
7
+ data.tar.gz: 0cbd7666b9391ee5c1b78a49393040dcb25171d30e3ad5e382cf0a515818afbbb0ff60591e6f7dd5d7521bcfc3e8cfab32b9663bf50a61565e465a5a91aab26d
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FixtureBot
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/fixture_bot.rb CHANGED
@@ -28,7 +28,7 @@ module FixtureBot
28
28
  else
29
29
  colored_output "Full load fixtures"
30
30
 
31
- clean_db
31
+ ActiveRecord::Tasks::DatabaseTasks.truncate_all
32
32
  load_models
33
33
  define_fixture_helpers
34
34
  FixtureBot::FixtureCreator.load_to_db
@@ -56,7 +56,6 @@ module FixtureBot
56
56
  end
57
57
 
58
58
  def caching_max_mtime_fixtures(dump_record_ids)
59
- truncate_tables(["__fixture_bot_cache_v1"])
60
59
  connection.execute <<-SQL
61
60
  INSERT INTO __fixture_bot_cache_v1 VALUES ('#{max_mtime_fixtures.iso8601(6)}', '#{Base64.encode64(dump_record_ids)}')
62
61
  SQL
@@ -74,32 +73,10 @@ module FixtureBot
74
73
  ::FactoryBot::SyntaxRunner.include(::FixtureBot::Helpers)
75
74
  end
76
75
 
77
- RESERVED_TABLES = %w[
78
- ar_internal_metadata
79
- schema_migrations
80
- ].freeze
81
-
82
- def clean_db
83
- connection.disable_referential_integrity do
84
- connection.execute(truncate_tables(connection.tables - RESERVED_TABLES))
85
- end
86
- end
87
-
88
76
  def connection
89
77
  ::ActiveRecord::Base.connection
90
78
  end
91
79
 
92
- def truncate_tables(tables)
93
- case connection.adapter_name
94
- when "SQLite"
95
- tables.map { |table| "DELETE FROM #{connection.quote_table_name(table)}" }.join(";")
96
- when "PostgreSQL"
97
- "TRUNCATE TABLE #{tables.map { |table| connection.quote_table_name(table) }.join(',')} RESTART IDENTITY CASCADE"
98
- else
99
- "TRUNCATE TABLE #{tables.map { |table| connection.quote_table_name(table) }.join(',')}"
100
- end
101
- end
102
-
103
80
  def colored_output(text)
104
81
  puts "\e[33m#{text}\e[0m"
105
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixture_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ermolaev Andrey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-25 00:00:00.000000000 Z
11
+ date: 2025-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord