Added project status and asynchronous initialization

This commit is contained in:
2025-10-21 22:53:32 +03:00
parent 25f8e3ad42
commit 293bc06d1e
7 changed files with 62 additions and 11 deletions
+18
View File
@@ -0,0 +1,18 @@
# frozen_string_literal: true
class ProjectPostInitJob < ApplicationJob
queue_as :default
def perform(project_id)
project = Project.preparing.find(project_id)
create_tasks_number_sequence(project)
project.update!(status: :ready)
end
private
def create_tasks_number_sequence(project)
Project.connection.execute "CREATE SEQUENCE IF NOT EXISTS #{project.tasks_number_sequence_name} AS INT UNSIGNED"
end
end