code: func (dm *DjangoMigration) Upsert(db XODB) error {
  	var err error
  
  	// if already exist, bail
  	if dm._exists {
  		return errors.New("insert failed: already exists")
  	}
  
  	// sql query
  	const sqlstr = `INSERT INTO public.django_migrations (` +
  		`id, app, name, applied` +
  		`) VALUES (` +
  		`$1, $2, $3, $4` +
  		`) ON CONFLICT (id) DO UPDATE SET (` +
  		`id, app, name, applied` +
  		`) = (` +
  		`EXCLUDED.id, EXCLUDED.app, EXCLUDED.name, EXCLUDED.applied` +
  		`)`
  
  	// run query
  	XOLog(sqlstr, dm.ID, dm.App, dm.Name, dm.Applied)
  	_, err = db.Exec(sqlstr, dm.ID, dm.App, dm.Name, dm.Applied)
  	if err != nil {
  		return err
  	}
  
  	// set existence
  	dm._exists = true
  
  	return nil
  }
docs: // Upsert performs an upsert for DjangoMigration.
  //
  // NOTE: PostgreSQL 9.5+ only