Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raw SQL doesn't get interpreted by apartment to use schemas #659

Open
DonGiulio opened this issue Oct 6, 2020 · 0 comments
Open

raw SQL doesn't get interpreted by apartment to use schemas #659

DonGiulio opened this issue Oct 6, 2020 · 0 comments

Comments

@DonGiulio
Copy link

Steps to reproduce

create a migration with raw sql in it,

for example:

`

class createListView < ActiveRecord::Migration
  def up
    execute <<-SQL
    create view list as
      SELECT
      'House' AS type,
      houses.id AS id
      FROM houses
      WHERE houses.id IS NOT NULL
      UNION
      SELECT
      'Apartment' AS type,
      apartments.id AS id,
      FROM apartments
      WHERE apartments.id IS NOT NULL;
    SQL
  end

  def down
    execute 'drop view list'
  end
end

`

Expected behavior

a view is created on all tenant schemas

Actual behavior

schemas don't have the view, only the public schema has it.

System configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant