Commit 8e15b611 authored by Eugenia Grieff's avatar Eugenia Grieff

Add scheduled_at field to jira_imports table

Change field method used in JiraImportType

- Change description of scheduled_at
- Update GraphQL schema and docs

Test change in schedule_at when job scheduled
parent 19aa7cb7
......@@ -8,8 +8,7 @@ module Types
graphql_name 'JiraImport'
field :scheduled_at, Types::TimeType, null: true,
method: :created_at,
description: 'Timestamp of when the Jira import was created'
description: 'Timestamp of when the Jira import was scheduled'
field :scheduled_by, Types::UserType, null: true,
description: 'User that started the Jira import'
field :jira_project_key, GraphQL::STRING_TYPE, null: false,
......
......@@ -46,7 +46,7 @@ class JiraImportState < ApplicationRecord
after_transition initial: :scheduled do |state, _|
state.run_after_commit do
job_id = Gitlab::JiraImport::Stage::StartImportWorker.perform_async(project.id)
state.update(jid: job_id) if job_id
state.update(jid: job_id, scheduled_at: Time.now) if job_id
end
end
......
---
title: Add scheduled_at field to jira_imports table
merge_request: 30284
author:
type: added
# frozen_string_literal: true
class AddScheduledAtToJiraImports < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
add_column :jira_imports, :scheduled_at, :datetime_with_timezone
end
end
......@@ -3433,7 +3433,8 @@ CREATE TABLE public.jira_imports (
status smallint DEFAULT 0 NOT NULL,
jid character varying(255),
jira_project_key character varying(255) NOT NULL,
jira_project_name character varying(255) NOT NULL
jira_project_name character varying(255) NOT NULL,
scheduled_at timestamp with time zone
);
CREATE SEQUENCE public.jira_imports_id_seq
......@@ -13483,6 +13484,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200423080334
20200423080607
20200423081409
20200423101529
20200424050250
\.
......@@ -4465,7 +4465,7 @@ type JiraImport {
jiraProjectKey: String!
"""
Timestamp of when the Jira import was created
Timestamp of when the Jira import was scheduled
"""
scheduledAt: Time
......
......@@ -12655,7 +12655,7 @@
},
{
"name": "scheduledAt",
"description": "Timestamp of when the Jira import was created",
"description": "Timestamp of when the Jira import was scheduled",
"args": [
],
......
......@@ -668,7 +668,7 @@ Autogenerated return type of IssueSetWeight
| Name | Type | Description |
| --- | ---- | ---------- |
| `jiraProjectKey` | String! | Project key for the imported Jira project |
| `scheduledAt` | Time | Timestamp of when the Jira import was created |
| `scheduledAt` | Time | Timestamp of when the Jira import was scheduled |
| `scheduledBy` | User | User that started the Jira import |
## JiraImportStartPayload
......
......@@ -124,6 +124,7 @@ describe JiraImportState do
jira_import.schedule
expect(jira_import.jid).to eq('some-job-id')
expect(jira_import.scheduled_at).to be_within(1.second).of(Time.now)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment