gilbitron / Arrest-MySQL

A "plug-n-play" RESTful API for your MySQL database.
131 stars 219 forks source link

automatic detection of table index field #7

Open aequitas opened 11 years ago

aequitas commented 11 years ago

Instead of having to specify the primary key field of a table manually for every table, could it be auto detected instead?

ludesign commented 11 years ago

You can run this query against every table and you'll have the primary key.

SHOW KEYS FROM table_name WHERE Key_name = 'PRIMARY'

I took a quick look at the source code and it seems quite easy to implement.

I will send pull request, until then you can checkout/pull the changes from my repository.