upd common added column auditory
This commit is contained in:
parent
8b01e8e76f
commit
f48c0b89c0
@ -33,9 +33,10 @@ INSERT INTO question (
|
|||||||
content,
|
content,
|
||||||
parent_ids,
|
parent_ids,
|
||||||
updated_at,
|
updated_at,
|
||||||
session
|
session,
|
||||||
|
auditory
|
||||||
)
|
)
|
||||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)
|
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)
|
||||||
RETURNING id, created_at, updated_at;
|
RETURNING id, created_at, updated_at;
|
||||||
|
|
||||||
-- name: DeleteQuestion :one
|
-- name: DeleteQuestion :one
|
||||||
|
1
dal/schema/000022_init.down.sql
Normal file
1
dal/schema/000022_init.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE question DROP CONSTRAINT IF EXISTS fk_auditory, DROP COLUMN IF EXISTS auditory;
|
2
dal/schema/000022_init.up.sql
Normal file
2
dal/schema/000022_init.up.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE question ADD COLUMN auditory BIGINT,
|
||||||
|
ADD CONSTRAINT fk_auditory FOREIGN KEY (auditory) REFERENCES gigachatAudience(ID);
|
@ -106,7 +106,8 @@ type Question struct {
|
|||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
Session string `json:"session"`
|
Session string `json:"session"`
|
||||||
|
Auditory int64 `json:"auditory"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Answer record of question answer
|
// Answer record of question answer
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
"gitea.pena/SQuiz/common/dal/sqlcgen"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
"gitea.pena/SQuiz/common/model"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/pj_errors"
|
"gitea.pena/SQuiz/common/pj_errors"
|
||||||
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -110,6 +110,8 @@ func (r *QuestionRepository) GetQuestionList(
|
|||||||
whereClause = append(whereClause, fmt.Sprintf("to_tsvector('russian', que.title) @@ to_tsquery('russian', $%d)", len(data)))
|
whereClause = append(whereClause, fmt.Sprintf("to_tsvector('russian', que.title) @@ to_tsquery('russian', $%d)", len(data)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
whereClause = append(whereClause, "que.auditory IS NULL")
|
||||||
|
|
||||||
data = append(data, limit, offset)
|
data = append(data, limit, offset)
|
||||||
if len(whereClause) != 0 {
|
if len(whereClause) != 0 {
|
||||||
query = fmt.Sprintf(query,
|
query = fmt.Sprintf(query,
|
||||||
|
@ -3,6 +3,7 @@ package statistics
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
"gitea.pena/SQuiz/common/dal/sqlcgen"
|
"gitea.pena/SQuiz/common/dal/sqlcgen"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ packages:
|
|||||||
- "./dal/schema/000020_init.down.sql"
|
- "./dal/schema/000020_init.down.sql"
|
||||||
- "./dal/schema/000021_init.up.sql"
|
- "./dal/schema/000021_init.up.sql"
|
||||||
- "./dal/schema/000021_init.down.sql"
|
- "./dal/schema/000021_init.down.sql"
|
||||||
|
- "./dal/schema/000022_init.up.sql"
|
||||||
|
- "./dal/schema/000022_init.down.sql"
|
||||||
engine: "postgresql"
|
engine: "postgresql"
|
||||||
emit_json_tags: true
|
emit_json_tags: true
|
||||||
emit_db_tags: true
|
emit_db_tags: true
|
||||||
|
Loading…
Reference in New Issue
Block a user