Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

automatic detection of table index field #7

Open
aequitas opened this issue Jul 7, 2013 · 1 comment
Open

automatic detection of table index field #7

aequitas opened this issue Jul 7, 2013 · 1 comment

Comments

@aequitas
Copy link

aequitas commented Jul 7, 2013

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

@ludesign
Copy link

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.

  • Edit -
    I have forked this project and added auto collection of table indexes. It was even easier as the original author was using SHOW COLUMNS FROM. Also will work with composite PRIMARY KEY tables.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants