@@ -6,27 +6,27 @@ class MultiDatabaseTest < ActiveSupport::TestCase
66 def setup
77 super
88 # Create memory tables - always recreate for clean state
9- SqliteRecord . connection . create_table :memory_tags , force : true do |t |
9+ LiteRecord . connection . create_table :memory_tags , force : true do |t |
1010 t . string :name
1111 t . integer :parent_id
1212 t . timestamps
1313 end
1414
15- SqliteRecord . connection . create_table :memory_tag_hierarchies , id : false , force : true do |t |
15+ LiteRecord . connection . create_table :memory_tag_hierarchies , id : false , force : true do |t |
1616 t . integer :ancestor_id , null : false
1717 t . integer :descendant_id , null : false
1818 t . integer :generations , null : false
1919 end
2020
21- SqliteRecord . connection . add_index :memory_tag_hierarchies , %i[ ancestor_id descendant_id generations ] ,
21+ LiteRecord . connection . add_index :memory_tag_hierarchies , %i[ ancestor_id descendant_id generations ] ,
2222 unique : true , name : 'memory_tag_anc_desc_idx'
23- SqliteRecord . connection . add_index :memory_tag_hierarchies , [ :descendant_id ] , name : 'memory_tag_desc_idx'
23+ LiteRecord . connection . add_index :memory_tag_hierarchies , [ :descendant_id ] , name : 'memory_tag_desc_idx'
2424 end
2525
2626 def teardown
2727 # Clean up SQLite tables after each test
28- SqliteRecord . connection . drop_table :memory_tag_hierarchies , if_exists : true
29- SqliteRecord . connection . drop_table :memory_tags , if_exists : true
28+ LiteRecord . connection . drop_table :memory_tag_hierarchies , if_exists : true
29+ LiteRecord . connection . drop_table :memory_tags , if_exists : true
3030 super
3131 end
3232
@@ -46,13 +46,13 @@ def test_postgresql_with_advisory_lock
4646 end
4747
4848 def test_mysql_with_advisory_lock
49- skip 'MySQL not configured' unless mysql? ( MysqlRecord . connection )
49+ skip 'MySQL not configured' unless mysql? ( SecondaryRecord . connection )
5050
51- tag = MysqlTag . create! ( name : 'MySQL Root' )
51+ tag = SecondaryTag . create! ( name : 'MySQL Root' )
5252 child = nil
5353
5454 # Advisory locks should work on MySQL
55- MysqlTag . with_advisory_lock ( 'test_lock' ) do
55+ SecondaryTag . with_advisory_lock ( 'test_lock' ) do
5656 child = tag . children . create! ( name : 'MySQL Child' )
5757 end
5858
@@ -80,21 +80,21 @@ def test_concurrent_operations_different_databases
8080 pg_tag . children . create! ( name : 'PG Child 1' )
8181 end
8282
83- mysql_tag = MysqlTag . create! ( name : 'MySQL Root' )
83+ mysql_tag = SecondaryTag . create! ( name : 'MySQL Root' )
8484 sqlite_tag = MemoryTag . create! ( name : 'SQLite Root' )
8585
8686 # Test concurrent operations only for MySQL and SQLite
8787 threads = [ ]
8888
8989 threads << Thread . new do
90- MysqlRecord . connection_pool . with_connection do
91- tag = MysqlTag . find ( mysql_tag . id )
90+ SecondaryRecord . connection_pool . with_connection do
91+ tag = SecondaryTag . find ( mysql_tag . id )
9292 tag . children . create! ( name : 'MySQL Child 1' )
9393 end
9494 end
9595
9696 threads << Thread . new do
97- SqliteRecord . connection_pool . with_connection do
97+ LiteRecord . connection_pool . with_connection do
9898 tag = MemoryTag . find ( sqlite_tag . id )
9999 tag . children . create! ( name : 'SQLite Child 1' )
100100 end
0 commit comments