The problem is in this method:
private[activerecord] def isCreated: Boolean = inTransaction {
all.headOption.exists{ t =>
try {
val name = config.adapter.quoteName(t.prefixedName)
execute("select 1 from " + name + " limit 1", false)
true
} catch {
case e: Throwable => false
}
}
}
When I run Tables.initialize on the empty database, it runs ok. The second run checks for each table presence. The SQL throws an exception, which is caught, returning false. The initialize method then thinks the table is not created and tries to create it causing:
java.sql.SQLSyntaxErrorException: ORA-00955: name is already used by an existing object