mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-11-22 22:26:46 +01:00
28 lines
516 B
Go
28 lines
516 B
Go
|
package keystore
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
|
||
|
"github.com/jackc/pgx/v5/pgxpool"
|
||
|
)
|
||
|
|
||
|
func applyMigration(dbPool *pgxpool.Pool) error {
|
||
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||
|
defer cancel()
|
||
|
|
||
|
_, err := dbPool.Exec(ctx, `
|
||
|
CREATE TABLE IF NOT EXISTS keystore (
|
||
|
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||
|
public_key TEXT NOT NULL,
|
||
|
private_key TEXT NOT NULL,
|
||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||
|
);
|
||
|
`)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|