We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e34d55c commit e4cbe14Copy full SHA for e4cbe14
config/initializers/xata_compatibility.rb
@@ -0,0 +1,18 @@
1
+# Xata database compatibility
2
+# Xata doesn't support CREATE EXTENSION statements but has plpgsql enabled by default
3
+
4
+# Prevent extension enabling when using Xata
5
+if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
6
+ module XataExtensionPrevention
7
+ def enable_extension(name, **)
8
+ # Skip enabling extensions on Xata (they're already enabled)
9
+ if ENV["DATABASE_URL"]&.include?("xata.sh")
10
+ Rails.logger&.info "Skipping extension '#{name}' - Xata has it enabled by default"
11
+ return
12
+ end
13
+ super
14
15
16
17
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(XataExtensionPrevention)
18
+end
0 commit comments