feat: add completion_date field to projects and update related functionalities in forms and queries
This commit is contained in:
@@ -27,6 +27,7 @@ export default function initializeDatabase() {
|
||||
city TEXT,
|
||||
investment_number TEXT,
|
||||
finish_date TEXT,
|
||||
completion_date TEXT,
|
||||
wp TEXT,
|
||||
contact TEXT,
|
||||
notes TEXT,
|
||||
@@ -280,6 +281,14 @@ export default function initializeDatabase() {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
|
||||
try {
|
||||
db.exec(`
|
||||
ALTER TABLE projects ADD COLUMN completion_date TEXT;
|
||||
`);
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
|
||||
// Migration: Update task status system - add 'not_started' status
|
||||
// DISABLED: This migration was running on every init and converting legitimate
|
||||
// 'pending' tasks back to 'not_started'. The initial migration has been completed.
|
||||
|
||||
@@ -75,9 +75,9 @@ export function createProject(data, userId = null) {
|
||||
|
||||
const stmt = db.prepare(`
|
||||
INSERT INTO projects (
|
||||
contract_id, project_name, project_number, address, plot, district, unit, city, investment_number, finish_date,
|
||||
contract_id, project_name, project_number, address, plot, district, unit, city, investment_number, finish_date, completion_date,
|
||||
wp, contact, notes, wartosc_zlecenia, project_type, project_status, coordinates, created_by, assigned_to, created_at, updated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now', 'localtime'), datetime('now', 'localtime'))
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now', 'localtime'), datetime('now', 'localtime'))
|
||||
`);
|
||||
|
||||
const result = stmt.run(
|
||||
@@ -91,6 +91,7 @@ export function createProject(data, userId = null) {
|
||||
data.city,
|
||||
data.investment_number,
|
||||
data.finish_date,
|
||||
data.completion_date,
|
||||
data.wp,
|
||||
data.contact,
|
||||
data.notes,
|
||||
@@ -109,7 +110,7 @@ export function updateProject(id, data, userId = null) {
|
||||
const stmt = db.prepare(`
|
||||
UPDATE projects SET
|
||||
contract_id = ?, project_name = ?, project_number = ?, address = ?, plot = ?, district = ?, unit = ?, city = ?,
|
||||
investment_number = ?, finish_date = ?, wp = ?, contact = ?, notes = ?, wartosc_zlecenia = ?, project_type = ?, project_status = ?,
|
||||
investment_number = ?, finish_date = ?, completion_date = ?, wp = ?, contact = ?, notes = ?, wartosc_zlecenia = ?, project_type = ?, project_status = ?,
|
||||
coordinates = ?, assigned_to = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE project_id = ?
|
||||
`);
|
||||
@@ -124,6 +125,7 @@ export function updateProject(id, data, userId = null) {
|
||||
data.city,
|
||||
data.investment_number,
|
||||
data.finish_date,
|
||||
data.completion_date,
|
||||
data.wp,
|
||||
data.contact,
|
||||
data.notes,
|
||||
|
||||
Reference in New Issue
Block a user