(db *datastore)
| 18 | ) |
| 19 | |
| 20 | func oauthAttach(db *datastore) error { |
| 21 | dialect := wf_db.DialectMySQL |
| 22 | if db.driverName == driverSQLite { |
| 23 | dialect = wf_db.DialectSQLite |
| 24 | } |
| 25 | return wf_db.RunTransactionWithOptions(context.Background(), db.DB, &sql.TxOptions{}, func(ctx context.Context, tx *sql.Tx) error { |
| 26 | builders := []wf_db.SQLBuilder{ |
| 27 | dialect. |
| 28 | AlterTable("oauth_client_states"). |
| 29 | AddColumn(dialect. |
| 30 | Column( |
| 31 | "attach_user_id", |
| 32 | wf_db.ColumnTypeInteger, |
| 33 | wf_db.OptionalInt{Set: true, Value: 24}).SetNullable(true)), |
| 34 | } |
| 35 | for _, builder := range builders { |
| 36 | query, err := builder.ToSQL() |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | if _, err := tx.ExecContext(ctx, query); err != nil { |
| 41 | return err |
| 42 | } |
| 43 | } |
| 44 | return nil |
| 45 | }) |
| 46 | } |
nothing calls this directly
no test coverage detected