mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-06-08 05:55:42 +09:00
update: add start and end date for campaigns
This commit is contained in:
parent
cb6e50b7dc
commit
f5e6caf936
2 changed files with 21 additions and 6 deletions
|
@ -1,7 +1,23 @@
|
|||
function insert_qaqc_campaign_id(db::SQLite.DB)
|
||||
campaigns = [1, 2, 3]
|
||||
stmt = DBInterface.prepare(db, sql"INSERT INTO qaqc_campaigns VALUES (:id, :note)")
|
||||
DBInterface.executemany(stmt, (id = campaigns, note = fill(nothing, size(campaigns))))
|
||||
dates = [
|
||||
(DateTime(2024, 7, 22), DateTime(2024, 7, 24)),
|
||||
(DateTime(2024, 8, 6), DateTime(2024, 8, 9)),
|
||||
(DateTime(2024, 9, 10), DateTime(2024, 9, 12)),
|
||||
]
|
||||
stmt = DBInterface.prepare(
|
||||
db,
|
||||
sql"INSERT INTO qaqc_campaigns VALUES (:id, :start_date, :end_date, :note)",
|
||||
)
|
||||
DBInterface.executemany(
|
||||
stmt,
|
||||
(
|
||||
id = campaigns,
|
||||
start_date = dates .|> (x -> x[1]) .|> string,
|
||||
end_date = dates .|> (x -> x[2]) .|> string,
|
||||
note = fill(nothing, size(campaigns)),
|
||||
),
|
||||
)
|
||||
|
||||
nothing
|
||||
end
|
||||
|
@ -323,10 +339,7 @@ function add_qaqcdispatch(db::SQLite.DB, dispatch_table::DataFrame)
|
|||
|
||||
DBInterface.executemany(
|
||||
stmt,
|
||||
(
|
||||
campaign_id = dispatch_table.campaign_id,
|
||||
psboard_id = dispatch_table.psboard_id,
|
||||
)
|
||||
(campaign_id = dispatch_table.campaign_id, psboard_id = dispatch_table.psboard_id),
|
||||
)
|
||||
|
||||
nothing
|
||||
|
|
|
@ -46,6 +46,8 @@ CREATE TABLE qaqc_dispatch (
|
|||
|
||||
CREATE TABLE qaqc_campaigns (
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
start_date DATETIME NOT NULL,
|
||||
end_date DATETIME NOT NULL,
|
||||
note TEXT
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue