Complete all standard object migration to the new workspace schema (#2492)

* Complete all standard object migration to the new workspace schema

* Fixes
This commit is contained in:
Charles Bochet 2023-11-14 10:24:36 +01:00 committed by GitHub
parent f476129afa
commit 5566e6fba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 531 additions and 51 deletions

View File

@ -100,7 +100,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: 'DATE',
name: 'reminderAt', name: 'reminderAt',
label: 'Reminder Date', label: 'Reminder Date',
targetColumnMap: { targetColumnMap: {
@ -116,7 +116,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: 'DATE',
name: 'dueAt', name: 'dueAt',
label: 'Due Date', label: 'Due Date',
targetColumnMap: { targetColumnMap: {
@ -132,7 +132,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: 'DATE',
name: 'completedAt', name: 'completedAt',
label: 'Completion Date', label: 'Completion Date',
targetColumnMap: { targetColumnMap: {

View File

@ -57,7 +57,7 @@ export const seedApiKeyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: 'DATE',
name: 'expiresAt', name: 'expiresAt',
label: 'Expiration date', label: 'Expiration date',
targetColumnMap: { targetColumnMap: {
@ -73,7 +73,7 @@ export const seedApiKeyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: 'DATE',
name: 'revokedAt', name: 'revokedAt',
label: 'Revocation date', label: 'Revocation date',
targetColumnMap: { targetColumnMap: {

View File

@ -44,7 +44,7 @@ export const seedFavoriteFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: 'NUMBER',
name: 'position', name: 'position',
label: 'Position', label: 'Position',
targetColumnMap: { targetColumnMap: {

View File

@ -46,7 +46,7 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'MONEY', type: 'NUMBER',
name: 'amount', name: 'amount',
label: 'Amount', label: 'Amount',
targetColumnMap: { targetColumnMap: {
@ -78,7 +78,7 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'PROBABILITY', type: 'TEXT',
name: 'probability', name: 'probability',
label: 'Probability', label: 'Probability',
targetColumnMap: { targetColumnMap: {

View File

@ -5,13 +5,13 @@ import { SeedWorkspaceId } from 'src/database/seeds/metadata';
const fieldMetadataTableName = 'fieldMetadata'; const fieldMetadataTableName = 'fieldMetadata';
export enum SeedWorkspaceMemberSettingsFieldMetadataIds { export enum SeedWorkspaceMemberSettingFieldMetadataIds {
ColorScheme = '20202020-d7b7-4f2e-bb52-90d3fd78007a', ColorScheme = '20202020-d7b7-4f2e-bb52-90d3fd78007a',
Locale = '20202020-10f6-4df9-8d6f-a760b65bd800', Locale = '20202020-10f6-4df9-8d6f-a760b65bd800',
WorkspaceMember = '20202020-83f2-4c5f-96b0-0c51ecc160e3', WorkspaceMember = '20202020-83f2-4c5f-96b0-0c51ecc160e3',
} }
export const seedWorkspaceMemberSettingsFieldMetadata = async ( export const seedWorkspaceMemberSettingFieldMetadata = async (
workspaceDataSource: DataSource, workspaceDataSource: DataSource,
schemaName: string, schemaName: string,
) => { ) => {
@ -36,8 +36,8 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
.values([ .values([
// Scalar fields // Scalar fields
{ {
id: SeedWorkspaceMemberSettingsFieldMetadataIds.ColorScheme, id: SeedWorkspaceMemberSettingFieldMetadataIds.ColorScheme,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings, objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
@ -52,8 +52,8 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
isNullable: false, isNullable: false,
}, },
{ {
id: SeedWorkspaceMemberSettingsFieldMetadataIds.Locale, id: SeedWorkspaceMemberSettingFieldMetadataIds.Locale,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings, objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
@ -61,7 +61,7 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
name: 'locale', name: 'locale',
label: 'Language', label: 'Language',
targetColumnMap: { targetColumnMap: {
value: 'colorScheme', value: 'locale',
}, },
description: 'Preferred language', description: 'Preferred language',
icon: 'IconLanguage', icon: 'IconLanguage',
@ -70,8 +70,8 @@ export const seedWorkspaceMemberSettingsFieldMetadata = async (
// Relationships // Relationships
{ {
id: SeedWorkspaceMemberSettingsFieldMetadataIds.WorkspaceMember, id: SeedWorkspaceMemberSettingFieldMetadataIds.WorkspaceMember,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings, objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,

View File

@ -6,6 +6,8 @@ import { SeedWorkspaceId } from 'src/database/seeds/metadata';
const fieldMetadataTableName = 'fieldMetadata'; const fieldMetadataTableName = 'fieldMetadata';
export enum SeedWorkspaceMemberFieldMetadataIds { export enum SeedWorkspaceMemberFieldMetadataIds {
FirstName = '20202020-1fa8-4d38-9fa4-0cf696909298',
LastName = '20202020-8c37-4163-ba06-1dada334ce3e',
AllowImpersonation = '20202020-bb19-44a1-8156-8866f87a5f42', AllowImpersonation = '20202020-bb19-44a1-8156-8866f87a5f42',
UserId = '20202020-f2c1-4ca1-9ca5-7b9d5cc87eb0', UserId = '20202020-f2c1-4ca1-9ca5-7b9d5cc87eb0',
AuthoredActivities = '20202020-37a0-4db4-9c9f-fd3e3f4e47fc', AuthoredActivities = '20202020-37a0-4db4-9c9f-fd3e3f4e47fc',
@ -41,6 +43,38 @@ export const seedWorkspaceMemberFieldMetadata = async (
.orIgnore() .orIgnore()
.values([ .values([
// Scalar fields // Scalar fields
{
id: SeedWorkspaceMemberFieldMetadataIds.FirstName,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
name: 'firstName',
label: 'First name',
targetColumnMap: {
value: 'firstName',
},
description: 'Workspace member first name',
icon: 'IconCircleUser',
isNullable: false,
},
{
id: SeedWorkspaceMemberFieldMetadataIds.LastName,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: 'TEXT',
name: 'lastName',
label: 'Last name',
targetColumnMap: {
value: 'lastName',
},
description: 'Workspace member last name',
icon: 'IconCircleUser',
isNullable: false,
},
{ {
id: SeedWorkspaceMemberFieldMetadataIds.UserId, id: SeedWorkspaceMemberFieldMetadataIds.UserId,
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember, objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
@ -166,10 +200,10 @@ export const seedWorkspaceMemberFieldMetadata = async (
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: 'RELATION',
name: 'settings', name: 'setting',
label: 'Settings', label: 'Settings',
targetColumnMap: { targetColumnMap: {
value: 'settingsId', value: 'settingId',
}, },
description: 'Workspace member settings', description: 'Workspace member settings',
icon: 'IconSettings', icon: 'IconSettings',

View File

@ -17,12 +17,12 @@ import { seedOpportunityFieldMetadata } from 'src/database/typeorm-seeds/metadat
import { seedPersonFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/person'; import { seedPersonFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/person';
import { seedPipelineStepFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/pipeline-step'; import { seedPipelineStepFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/pipeline-step';
import { seedWorkspaceMemberFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member'; import { seedWorkspaceMemberFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member';
import { seedWorkspaceMemberSettingsFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-settings';
import { seedCompanyRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/company'; import { seedCompanyRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/company';
import { seedActivityRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/activity'; import { seedActivityRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/activity';
import { seedPipelineStepRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/pipeline-step'; import { seedPipelineStepRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/pipeline-step';
import { seedPersonRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/person'; import { seedPersonRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/person';
import { seedWorkspaceMemberRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/workspace-member'; import { seedWorkspaceMemberRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/workspace-member';
import { seedWorkspaceMemberSettingFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-setting';
export const seedMetadataSchema = async ( export const seedMetadataSchema = async (
workspaceDataSource: DataSource, workspaceDataSource: DataSource,
@ -46,7 +46,7 @@ export const seedMetadataSchema = async (
await seedViewSortFieldMetadata(workspaceDataSource, schemaName); await seedViewSortFieldMetadata(workspaceDataSource, schemaName);
await seedViewRelationMetadata(workspaceDataSource, schemaName); await seedViewRelationMetadata(workspaceDataSource, schemaName);
await seedWorkspaceMemberFieldMetadata(workspaceDataSource, schemaName); await seedWorkspaceMemberFieldMetadata(workspaceDataSource, schemaName);
await seedWorkspaceMemberSettingsFieldMetadata( await seedWorkspaceMemberSettingFieldMetadata(
workspaceDataSource, workspaceDataSource,
schemaName, schemaName,
); );

View File

@ -10,7 +10,7 @@ export enum SeedObjectMetadataIds {
Opportunity = '20202020-cae9-4ff4-9579-f7d9fe44c937', Opportunity = '20202020-cae9-4ff4-9579-f7d9fe44c937',
PipelineStep = '20202020-1029-4661-9e91-83bad932bdcd', PipelineStep = '20202020-1029-4661-9e91-83bad932bdcd',
WorkspaceMember = '20202020-b550-40bb-a96b-9ab54b664753', WorkspaceMember = '20202020-b550-40bb-a96b-9ab54b664753',
WorkspaceMemberSettings = '20202020-166d-445c-970f-da1ea43f1dc7', WorkspaceMemberSetting = '20202020-166d-445c-970f-da1ea43f1dc7',
Webhook = '20202020-ddee-40de-9c9b-5f82a3503360', Webhook = '20202020-ddee-40de-9c9b-5f82a3503360',
ApiKey = '20202020-d8d0-4c2d-a370-5499b2181d02', ApiKey = '20202020-d8d0-4c2d-a370-5499b2181d02',
Activity = '20202020-8ee3-4f67-84ab-1b7a6eb5a448', Activity = '20202020-8ee3-4f67-84ab-1b7a6eb5a448',
@ -112,7 +112,7 @@ export const seedObjectMetadata = async (
isActive: true, isActive: true,
}, },
{ {
id: SeedObjectMetadataIds.WorkspaceMemberSettings, id: SeedObjectMetadataIds.WorkspaceMemberSetting,
nameSingular: 'workspaceMemberSettingV2', nameSingular: 'workspaceMemberSettingV2',
namePlural: 'workspaceMemberSettingsV2', namePlural: 'workspaceMemberSettingsV2',
labelSingular: 'WorkspaceMemberSetting', labelSingular: 'WorkspaceMemberSetting',

View File

@ -5,11 +5,11 @@ import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/objec
import { SeedWorkspaceId } from 'src/database/seeds/metadata'; import { SeedWorkspaceId } from 'src/database/seeds/metadata';
import { SeedCompanyFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/company'; import { SeedCompanyFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
import { SeedWorkspaceMemberFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member'; import { SeedWorkspaceMemberFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member';
import { SeedWorkspaceMemberSettingsFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-settings';
import { SeedFavoriteFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/favorite'; import { SeedFavoriteFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/favorite';
import { SeedActivityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity'; import { SeedActivityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity';
import { SeedCommentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/comment'; import { SeedCommentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/comment';
import { SeedAttachmentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment'; import { SeedAttachmentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment';
import { SeedWorkspaceMemberSettingFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-setting';
const tableName = 'relationMetadata'; const tableName = 'relationMetadata';
@ -42,10 +42,10 @@ export const seedWorkspaceMemberRelationMetadata = async (
{ {
relationType: RelationMetadataType.ONE_TO_ONE, relationType: RelationMetadataType.ONE_TO_ONE,
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember, fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
toObjectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings, toObjectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSetting,
fromFieldMetadataId: SeedWorkspaceMemberFieldMetadataIds.Settings, fromFieldMetadataId: SeedWorkspaceMemberFieldMetadataIds.Settings,
toFieldMetadataId: toFieldMetadataId:
SeedWorkspaceMemberSettingsFieldMetadataIds.WorkspaceMember, SeedWorkspaceMemberSettingFieldMetadataIds.WorkspaceMember,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
}, },
{ {

View File

@ -32,11 +32,6 @@ export const addCompanyTable: TenantMigrationTableAction[] = [
columnType: 'integer', columnType: 'integer',
action: TenantMigrationColumnActionType.CREATE, action: TenantMigrationColumnActionType.CREATE,
}, },
{
columnName: 'linkedinUrl_link',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{ {
columnName: 'linkedinUrl', columnName: 'linkedinUrl',
columnType: 'varchar', columnType: 'varchar',

View File

@ -17,6 +17,16 @@ export const addActivityTargetTable: TenantMigrationTableAction[] = [
columnType: 'uuid', columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE, action: TenantMigrationColumnActionType.CREATE,
}, },
{
columnName: 'activityId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
], ],
}, },
]; ];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity'; import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addActivityTable: TenantMigrationTableAction[] = [ export const addActivityTable: TenantMigrationTableAction[] = [
{ {
@ -8,6 +11,47 @@ export const addActivityTable: TenantMigrationTableAction[] = [
{ {
name: 'activity', name: 'activity',
action: 'alter', action: 'alter',
columns: [], columns: [
{
columnName: 'title',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'body',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'type',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'reminderAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'dueAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'completedAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'authorId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'assigneeId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
}, },
]; ];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity'; import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addApiKeyTable: TenantMigrationTableAction[] = [ export const addApiKeyTable: TenantMigrationTableAction[] = [
{ {
@ -8,6 +11,22 @@ export const addApiKeyTable: TenantMigrationTableAction[] = [
{ {
name: 'apiKey', name: 'apiKey',
action: 'alter', action: 'alter',
columns: [], columns: [
{
columnName: 'name',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'revokedAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'expiresAt',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
],
}, },
]; ];

View File

@ -12,11 +12,41 @@ export const addAttachmentTable: TenantMigrationTableAction[] = [
name: 'attachment', name: 'attachment',
action: 'alter', action: 'alter',
columns: [ columns: [
{
columnName: 'name',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'fullPath',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'type',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{ {
columnName: 'companyId', columnName: 'companyId',
columnType: 'uuid', columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE, action: TenantMigrationColumnActionType.CREATE,
}, },
{
columnName: 'authorId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'activityId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
], ],
}, },
]; ];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity'; import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addCommentTable: TenantMigrationTableAction[] = [ export const addCommentTable: TenantMigrationTableAction[] = [
{ {
@ -8,6 +11,22 @@ export const addCommentTable: TenantMigrationTableAction[] = [
{ {
name: 'comment', name: 'comment',
action: 'alter', action: 'alter',
columns: [], columns: [
{
columnName: 'body',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'authorId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'activityId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
}, },
]; ];

View File

@ -12,11 +12,26 @@ export const addFavoriteTable: TenantMigrationTableAction[] = [
name: 'favorite', name: 'favorite',
action: 'alter', action: 'alter',
columns: [ columns: [
{
columnName: 'position',
columnType: 'float',
action: TenantMigrationColumnActionType.CREATE,
},
{ {
columnName: 'companyId', columnName: 'companyId',
columnType: 'uuid', columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE, action: TenantMigrationColumnActionType.CREATE,
}, },
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'workspaceMemberId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
], ],
}, },
]; ];

View File

@ -12,11 +12,41 @@ export const addOpportunityTable: TenantMigrationTableAction[] = [
name: 'opportunity', name: 'opportunity',
action: 'alter', action: 'alter',
columns: [ columns: [
{
columnName: 'amount',
columnType: 'float',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'probability',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'closeDate',
columnType: 'timestamp',
action: TenantMigrationColumnActionType.CREATE,
},
{ {
columnName: 'companyId', columnName: 'companyId',
columnType: 'uuid', columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE, action: TenantMigrationColumnActionType.CREATE,
}, },
{
columnName: 'personId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'pipelineStepId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'pointOfContactId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
], ],
}, },
]; ];

View File

@ -12,6 +12,51 @@ export const addPersonTable: TenantMigrationTableAction[] = [
name: 'person', name: 'person',
action: 'alter', action: 'alter',
columns: [ columns: [
{
columnName: 'firstName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'lastName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'email',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'linkedinUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'xUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'jobTitle',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'phone',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'city',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'avatarUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{ {
columnName: 'companyId', columnName: 'companyId',
columnType: 'uuid', columnType: 'uuid',

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity'; import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addPipelineStepTable: TenantMigrationTableAction[] = [ export const addPipelineStepTable: TenantMigrationTableAction[] = [
{ {
@ -8,6 +11,22 @@ export const addPipelineStepTable: TenantMigrationTableAction[] = [
{ {
name: 'pipelineStep', name: 'pipelineStep',
action: 'alter', action: 'alter',
columns: [], columns: [
{
columnName: 'name',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'color',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'position',
columnType: 'float',
action: TenantMigrationColumnActionType.CREATE,
},
],
}, },
]; ];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity'; import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWebhookTable: TenantMigrationTableAction[] = [ export const addWebhookTable: TenantMigrationTableAction[] = [
{ {
@ -8,6 +11,17 @@ export const addWebhookTable: TenantMigrationTableAction[] = [
{ {
name: 'webhook', name: 'webhook',
action: 'alter', action: 'alter',
columns: [], columns: [
{
columnName: 'targetUrl',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'operation',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
],
}, },
]; ];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity'; import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWorkspaceMemberSettingTable: TenantMigrationTableAction[] = [ export const addWorkspaceMemberSettingTable: TenantMigrationTableAction[] = [
{ {
@ -8,6 +11,22 @@ export const addWorkspaceMemberSettingTable: TenantMigrationTableAction[] = [
{ {
name: 'workspaceMemberSetting', name: 'workspaceMemberSetting',
action: 'alter', action: 'alter',
columns: [], columns: [
{
columnName: 'colorScheme',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'locale',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'workspaceMemberId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
}, },
]; ];

View File

@ -1,4 +1,7 @@
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity'; import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWorkspaceMemberTable: TenantMigrationTableAction[] = [ export const addWorkspaceMemberTable: TenantMigrationTableAction[] = [
{ {
@ -8,6 +11,32 @@ export const addWorkspaceMemberTable: TenantMigrationTableAction[] = [
{ {
name: 'workspaceMember', name: 'workspaceMember',
action: 'alter', action: 'alter',
columns: [], columns: [
{
columnName: 'firstName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'lastName',
columnType: 'varchar',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'allowImpersonation',
columnType: 'boolean',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'userId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
{
columnName: 'settingId',
columnType: 'uuid',
action: TenantMigrationColumnActionType.CREATE,
},
],
}, },
]; ];

View File

@ -14,6 +14,24 @@ export const addAttachmentRelations: TenantMigrationTableAction[] = [
referencedTableColumnName: 'id', referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION, action: TenantMigrationColumnActionType.RELATION,
}, },
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'activityId',
referencedTableName: 'activity',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'authorId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
], ],
}, },
]; ];

View File

@ -14,6 +14,18 @@ export const addFavoriteRelations: TenantMigrationTableAction[] = [
referencedTableColumnName: 'id', referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION, action: TenantMigrationColumnActionType.RELATION,
}, },
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'workspaceMemberId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
], ],
}, },
]; ];

View File

@ -0,0 +1,37 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addOpportunityRelations: TenantMigrationTableAction[] = [
{
name: 'opportunity',
action: 'alter',
columns: [
{
columnName: 'companyId',
referencedTableName: 'company',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'pointOfContactId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'pipelineStepId',
referencedTableName: 'pipelineStep',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -14,6 +14,18 @@ export const addActivityTargetRelations: TenantMigrationTableAction[] = [
referencedTableColumnName: 'id', referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION, action: TenantMigrationColumnActionType.RELATION,
}, },
{
columnName: 'personId',
referencedTableName: 'person',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'activityId',
referencedTableName: 'activity',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
], ],
}, },
]; ];

View File

@ -0,0 +1,25 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addActivityRelations: TenantMigrationTableAction[] = [
{
name: 'activity',
action: 'alter',
columns: [
{
columnName: 'authorId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'assigneeId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -0,0 +1,25 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addCommentRelations: TenantMigrationTableAction[] = [
{
name: 'comment',
action: 'alter',
columns: [
{
columnName: 'authorId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
{
columnName: 'activityId',
referencedTableName: 'activity',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -0,0 +1,20 @@
import {
TenantMigrationColumnActionType,
TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addWorkspaceMemberSettingRelations: TenantMigrationTableAction[] =
[
{
name: 'workspaceMemberSetting',
action: 'alter',
columns: [
{
columnName: 'workspaceMemberId',
referencedTableName: 'workspaceMember',
referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION,
},
],
},
];

View File

@ -3,14 +3,14 @@ import {
TenantMigrationTableAction, TenantMigrationTableAction,
} from 'src/metadata/tenant-migration/tenant-migration.entity'; } from 'src/metadata/tenant-migration/tenant-migration.entity';
export const addOpportunitiesRelations: TenantMigrationTableAction[] = [ export const addWorkspaceMemberRelations: TenantMigrationTableAction[] = [
{ {
name: 'opportunity', name: 'workspaceMember',
action: 'alter', action: 'alter',
columns: [ columns: [
{ {
columnName: 'companyId', columnName: 'settingId',
referencedTableName: 'company', referencedTableName: 'workspaceMemberSetting',
referencedTableColumnName: 'id', referencedTableColumnName: 'id',
action: TenantMigrationColumnActionType.RELATION, action: TenantMigrationColumnActionType.RELATION,
}, },

View File

@ -14,8 +14,12 @@ import { addCompanyRelations } from 'src/metadata/tenant-migration/migrations/16
import { addAttachmentRelations } from 'src/metadata/tenant-migration/migrations/1697618028-addAttachmentRelations'; import { addAttachmentRelations } from 'src/metadata/tenant-migration/migrations/1697618028-addAttachmentRelations';
import { addPersonRelations } from 'src/metadata/tenant-migration/migrations/1697618029-addPersonRelations'; import { addPersonRelations } from 'src/metadata/tenant-migration/migrations/1697618029-addPersonRelations';
import { addFavoriteRelations } from 'src/metadata/tenant-migration/migrations/1697618030-addFavoriteRelations'; import { addFavoriteRelations } from 'src/metadata/tenant-migration/migrations/1697618030-addFavoriteRelations';
import { addOpportunitiesRelations } from 'src/metadata/tenant-migration/migrations/1697618031-addOpportunitiesRelations';
import { addActivityTargetRelations } from 'src/metadata/tenant-migration/migrations/1697618032-addActivityTargetRelations'; import { addActivityTargetRelations } from 'src/metadata/tenant-migration/migrations/1697618032-addActivityTargetRelations';
import { addActivityRelations } from 'src/metadata/tenant-migration/migrations/1697618033-addActivityRelations';
import { addCommentRelations } from 'src/metadata/tenant-migration/migrations/1697618034-addCommentRelations';
import { addOpportunityRelations } from 'src/metadata/tenant-migration/migrations/1697618031-addOpportunityRelations';
import { addWorkspaceMemberSettingRelations } from 'src/metadata/tenant-migration/migrations/1697618035-addWorkspaceMemberSettingRelations';
import { addWorkspaceMemberRelations } from 'src/metadata/tenant-migration/migrations/1697618036-addWorkspaceMemberRelations';
import { addCompanyTable } from './migrations/1697618009-addCompanyTable'; import { addCompanyTable } from './migrations/1697618009-addCompanyTable';
import { addViewTable } from './migrations/1697618011-addViewTable'; import { addViewTable } from './migrations/1697618011-addViewTable';
@ -47,6 +51,11 @@ export const standardMigrations = {
'1697618028-addAttachmentRelations': addAttachmentRelations, '1697618028-addAttachmentRelations': addAttachmentRelations,
'1697618029-addPersonRelations': addPersonRelations, '1697618029-addPersonRelations': addPersonRelations,
'1697618030-addFavoriteRelations': addFavoriteRelations, '1697618030-addFavoriteRelations': addFavoriteRelations,
'1697618031-addOpportunitiesRelations': addOpportunitiesRelations, '1697618031-addOpportunitiesRelations': addOpportunityRelations,
'1697618032-addActivityTargetRelations': addActivityTargetRelations, '1697618032-addActivityTargetRelations': addActivityTargetRelations,
'1697618033-addActivityRelations': addActivityRelations,
'1697618034-addCommentRelations': addCommentRelations,
'1697618035-addWorkspaceMemberSettingRelations':
addWorkspaceMemberSettingRelations,
'1697618036-addWorkspaceMemberRelations': addWorkspaceMemberRelations,
}; };