Exposed: PostgreSQL: Referencing data on another schema

Created on 28 Aug 2017  路  6Comments  路  Source: JetBrains/Exposed

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)

enhancement

Most helpful comment

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

All 6 comments

@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) 
}

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

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

You may try this and leave feedback if that helps.

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kszymanski85 picture kszymanski85  路  4Comments

fmgonsalves picture fmgonsalves  路  3Comments

barry-m picture barry-m  路  3Comments

vasily-kirichenko picture vasily-kirichenko  路  4Comments

gcscaglia picture gcscaglia  路  3Comments