Add index generation and change PK generation

Add index generation and change PK generation