cloudwan / gohan

Gohan is an API Gateway Server written by Go that makes it easy for developers to create and maintain REST-style API
http://www.slideshare.net/natiueno/gohan-61170476
Other
109 stars 44 forks source link

Create indices based on an actual table name, rather than 'plural' parameter #646

Closed kubasobon closed 6 years ago

kubasobon commented 6 years ago

In current form, indices are being created based on Plural parameter, which is different than expected behaviour. This PR makes changes, so that database table name is used. This is accomplished by using GetDbTableName() function instead of the aforementioned Plural parameter.

For example, when using a schema:

id: puppy
  plural: puppies
  (...)

we expect database name to be puppys, not puppies.

Hence the proper index creation command should look like this: CREATE INDEX puppys_name_idx ON `puppys`(`name`); but in current version it looks like this: CREATE INDEX puppies_name_idx ON `puppies`(`name`);.