Skip to content

Commit e4cbe14

Browse files
author
github-actions
committed
update with project-syncing action
1 parent e34d55c commit e4cbe14

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
end
15+
end
16+
17+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(XataExtensionPrevention)
18+
end

0 commit comments

Comments
 (0)