code: func updateSchemaVersion(t *meta.Meta, job *model.Job) (int64, error) {
  	schemaVersion, err := t.GenSchemaVersion()
  	if err != nil {
  		return 0, errors.Trace(err)
  	}
  	diff := &model.SchemaDiff{
  		Version:  schemaVersion,
  		Type:     job.Type,
  		SchemaID: job.SchemaID,
  	}
  	if job.Type == model.ActionTruncateTable {
  		// Truncate table has two table ID, should be handled differently.
  		err = job.DecodeArgs(&diff.TableID)
  		if err != nil {
  			return 0, errors.Trace(err)
  		}
  		diff.OldTableID = job.TableID
  	} else if job.Type == model.ActionRenameTable {
  		err = job.DecodeArgs(&diff.OldSchemaID)
  		if err != nil {
  			return 0, errors.Trace(err)
  		}
  		diff.TableID = job.TableID
  	} else {
  		diff.TableID = job.TableID
  	}
  	err = t.SetSchemaDiff(diff)
  	return schemaVersion, errors.Trace(err)
  }
docs: // updateSchemaVersion increments the schema version by 1 and sets SchemaDiff.