From 4c4f6957ec6bfec24578a4c958f4cabc182c9fcf Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Fri, 21 Nov 2025 17:25:40 +0000 Subject: [PATCH] Drop sqlite compability, using a separate schema.rb --- config/initializers/sqlite_compatibility.rb | 44 --------------------- 1 file changed, 44 deletions(-) delete mode 100644 config/initializers/sqlite_compatibility.rb diff --git a/config/initializers/sqlite_compatibility.rb b/config/initializers/sqlite_compatibility.rb deleted file mode 100644 index 50d44c28b..000000000 --- a/config/initializers/sqlite_compatibility.rb +++ /dev/null @@ -1,44 +0,0 @@ -# SQLite compatibility layer - filters out MySQL-specific options when using SQLite - -# Define modules outside on_load so they're available immediately -module SQLiteCompatibility - module SQLiteTableDefinitionCompatibility - # Override column method to filter out MySQL-specific options - def column(name, type, **options) - # Check if we're using SQLite by checking the connection adapter - if @conn.is_a?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) - # Remove MySQL-specific options that SQLite doesn't support - options = options.except(:size, :charset, :collation, :unsigned) - end - super(name, type, **options) - end - - # Override index method to filter out MySQL-specific index options - def index(column_name, **options) - if @conn.is_a?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) - # SQLite doesn't support length-limited indexes - options = options.except(:length) - end - super(column_name, **options) - end - end - - module SQLiteSchemaStatementCompatibility - # Override create_table to filter out MySQL-specific table options - def create_table(table_name, **options) - if is_a?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) - # Remove MySQL-specific table options - options = options.except(:charset, :collation) - end - super(table_name, **options) - end - end -end - -# Also run when ActiveRecord loads (for cases where it loads later) -ActiveSupport.on_load(:active_record) do - if defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) - ActiveRecord::ConnectionAdapters::TableDefinition.prepend(SQLiteCompatibility::SQLiteTableDefinitionCompatibility) - ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend(SQLiteCompatibility::SQLiteSchemaStatementCompatibility) - end -end