Is there any way to change the table name of the models, or specify a table prefix, so that the model named People, for example, would reference the table TP_PEOPLE?
Asked
Active
Viewed 35 times
1 Answers
0
There is a way, you can use the @Table
annotation, such as:
@Table("TP_PEOPLE")
public class People extends Model {}
however, I would suggest to call your class Person
, since the instance of this class represent a single row from your table:
@Table("TP_PEOPLE")
public class Person extends Model {}
so that your code will look:
List<Person> people = Person.where("ssn = ?", ssn);

ipolevoy
- 5,432
- 2
- 31
- 46
-
Awesome! Thank you! BTW, my model actually is called Person. Not sure what I was thinking. – Scott Nelson Oct 12 '18 at 13:26