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

PostgreSQL: Referencing data on another schema #145

Closed
Hgmoa opened this issue Aug 28, 2017 · 6 comments · May be fixed by #1116
Closed

PostgreSQL: Referencing data on another schema #145

Hgmoa opened this issue Aug 28, 2017 · 6 comments · May be fixed by #1116

Comments

@Hgmoa
Copy link

Hgmoa commented Aug 28, 2017

First of all sry due to English not being my first language.

Am I able to do REFERENCES ,JOINS and other operations in between schemas with this framework?
I´m trying to wrap my head around it but I can only create tables in different schemas using this bit of code just before the create operation

fun Transaction.setSchema(schema: DatabaseSchemas){ exec("set SEARCH_PATH TO \"$schema\"") }

transaction { setSchema(DatabaseSchemas.XXXXXXX) createMissingTablesAndColumns(UsersTable) }

where DatabaseSchemas is an Enum of all My Schemas (done this way for ease of use)

@Tapac
Copy link
Contributor

Tapac commented Aug 28, 2017

@Hgmoa , Exposed doesn't support cross-schema interaction atm, but you can try to add schema to table name. I'm not sure that it will work, but plz give it a try and tell me if it helps you.

object Foo : IdTable("Schema.Foo) {} 
object Bar : Table {
    val foo by optReference("foo", Foo) 
}

@Tapac
Copy link
Contributor

Tapac commented Sep 8, 2017

@Hgmoa , any news? Was it possible to find any workaround for you problem with cross-schema relationships?

@sudoman281
Copy link

I need to use another schema than public. Is there any way to do it atm?

@Tapac
Copy link
Contributor

Tapac commented Jun 18, 2018

You may try this and leave feedback if that helps.

@Aleaje
Copy link

Aleaje commented Sep 28, 2018

@Tapac I tried your suggestion and it worked fine for me, i was able to join tables from different schemas

@voltangle
Copy link

I wrote table name like schema.table in table name, and it worked fine! It worked) tested on PostgreSQL

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