Add Index generation, change primary key gen

Add Index generation, change primary key gen