Is there any way to list all table instances? For ...
# exposed
j
Is there any way to list all table instances? For example to use in
SchemaUtils.statementsRequiredForDatabaseMigration()
I know SchemaUtils can list the names, but I don't know how to get the actual Table objects
c
Hi @Jørund Amsen
SchemaUtils.listTables()
returns the names of all defined tables in the default schema by actually querying the database metadata directly and caching the returned result strings. Exposed does not store anywhere a collection of any actual instances of the
Table
class. It's up to the user instantiating these objects to maintain some sort of registry of them, if required, either manually or via some design pattern that auto-caches new instances. If you happen to be using Spring though, you could checkout how Exposed currently discovers all tables in the spring-boot-module.