Add Index generation, change primary key generation

Add Index generation, change primary key generation