Improved the idevices table

Now the ID is a string and we are enforcing unique tokens in the
database, also changed name from devices to idevices to allow
more general device table