Module: PgRls::Schema::Dumper

Defined in:
lib/pg_rls/schema/dumper.rb

Instance Method Summary collapse

Instance Method Details

#table(table, stream) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pg_rls/schema/dumper.rb', line 6

def table(table, stream)
  temp_stream = StringIO.new
  super(table, temp_stream)
  temp_stream_string = temp_stream.string
  if rls_tenant_table?(table)
    temp_stream_string.gsub!('create_table', 'create_rls_tenant_table')
  elsif rls_table?(table)
    temp_stream_string.gsub!('create_table', 'create_rls_table')
  end

  stream.print(temp_stream_string)
end