DB 시간포멧 수정. access log 추가
This commit is contained in:
@@ -49,6 +49,8 @@ var (
|
||||
timeLayouts = []string{
|
||||
"2006-01-02 15:04:05.000",
|
||||
"2006-01-02 15:04:05",
|
||||
time.RFC3339,
|
||||
"2006-01-02T15:04:05.000Z07:00",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -63,6 +65,10 @@ func EnsureUserProgramReplica(ctx context.Context, conn *pgx.Conn, csvPath, sche
|
||||
logDir = "log"
|
||||
}
|
||||
|
||||
if err := ensureSchema(ctx, conn, schema); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := createReplicaTable(ctx, conn, schema, ReplicaTable); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -143,6 +149,14 @@ CREATE TABLE IF NOT EXISTS %s (
|
||||
return err
|
||||
}
|
||||
|
||||
func ensureSchema(ctx context.Context, conn *pgx.Conn, schema string) error {
|
||||
if schema == "" {
|
||||
return nil
|
||||
}
|
||||
_, err := conn.Exec(ctx, fmt.Sprintf(`CREATE SCHEMA IF NOT EXISTS %s`, pgx.Identifier{schema}.Sanitize()))
|
||||
return err
|
||||
}
|
||||
|
||||
type importResult struct {
|
||||
rowsCopied int64
|
||||
rowsUpserted int64
|
||||
|
||||
Reference in New Issue
Block a user