Enhance database schema and functions

- Added 'PHASE' value to the WL_TASK_LIST_COL_KEY enum type.
- Introduced sys_insert_license_types function to populate license types in the database.
- Updated sys_insert_project_templates function to include a new project template and adjusted associated task statuses.
- Modified organization insertion logic to set a longer trial period and change subscription status to 'active' for self-hosted licenses.
This commit is contained in:
chamiakJ
2025-04-21 00:12:10 +05:30
parent e42819ef64
commit 6efaeb3ff6
3 changed files with 28 additions and 285 deletions

View File

@@ -4876,8 +4876,8 @@ BEGIN
--insert organization data
INSERT INTO organizations (user_id, organization_name, contact_number, contact_number_secondary, trial_in_progress,
trial_expire_date, subscription_status, license_type_id)
VALUES (_user_id, TRIM((_body ->> 'displayName')::TEXT), NULL, NULL, TRUE, CURRENT_DATE + INTERVAL '14 days',
'trialing', (SELECT id FROM sys_license_types WHERE key = 'TRIAL'))
VALUES (_user_id, TRIM((_body ->> 'team_name')::TEXT), NULL, NULL, TRUE, CURRENT_DATE + INTERVAL '9999 days',
'active', (SELECT id FROM sys_license_types WHERE key = 'SELF_HOSTED'))
RETURNING id INTO _organization_id;
INSERT INTO teams (name, user_id, organization_id)
@@ -4958,10 +4958,11 @@ BEGIN
--insert organization data
INSERT INTO organizations (user_id, organization_name, contact_number, contact_number_secondary, trial_in_progress,
trial_expire_date, subscription_status, license_type_id)
VALUES (_user_id, TRIM((_body ->> 'team_name')::TEXT), NULL, NULL, TRUE, CURRENT_DATE + INTERVAL '14 days',
'trialing', (SELECT id FROM sys_license_types WHERE key = 'TRIAL'))
VALUES (_user_id, TRIM((_body ->> 'team_name')::TEXT), NULL, NULL, TRUE, CURRENT_DATE + INTERVAL '9999 days',
'active', (SELECT id FROM sys_license_types WHERE key = 'SELF_HOSTED'))
RETURNING id INTO _organization_id;
-- insert team
INSERT INTO teams (name, user_id, organization_id)
VALUES (_trimmed_team_name, _user_id, _organization_id)