Skip to content

Commit

Permalink
Added updated by fields to embeds model (#173)
Browse files Browse the repository at this point in the history
* CHARTS-10118 added updated by fields to model

* Review fix: set updated_at values from created_at
  • Loading branch information
TheXardas authored Aug 28, 2024
1 parent 8030af5 commit a83322d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {Knex} from 'knex';

export async function up(knex: Knex): Promise<void> {
return knex.raw(`
UPDATE embeds SET updated_by = created_by, updated_at = created_at;
ALTER TABLE embeds ALTER COLUMN updated_by SET NOT NULL;
`);
}

export async function down(knex: Knex): Promise<void> {
return knex.raw(`
ALTER TABLE embeds ALTER COLUMN updated_by DROP NOT NULL;
`);
}
4 changes: 4 additions & 0 deletions src/db/models/new/embed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const EmbedModelColumn = {
PublicParamsMode: 'publicParamsMode',
CreatedBy: 'createdBy',
CreatedAt: 'createdAt',
UpdatedBy: 'updatedBy',
UpdatedAt: 'updatedAt',
} as const;

export class EmbedModel extends Model {
Expand All @@ -32,4 +34,6 @@ export class EmbedModel extends Model {
[EmbedModelColumn.PublicParamsMode]!: boolean;
[EmbedModelColumn.CreatedBy]!: string;
[EmbedModelColumn.CreatedAt]!: string;
[EmbedModelColumn.UpdatedBy]!: string;
[EmbedModelColumn.UpdatedAt]!: string;
}
2 changes: 2 additions & 0 deletions src/db/presentations/joined-embed-embedding-secret/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const selectedEmbedColumns = [
EmbedModelColumn.PublicParamsMode,
EmbedModelColumn.CreatedBy,
EmbedModelColumn.CreatedAt,
EmbedModelColumn.UpdatedBy,
EmbedModelColumn.UpdatedAt,
] as const;

const selectedEmbeddingSecretsColumns = [EmbeddingSecretModelColumn.PublicKey] as const;
Expand Down

0 comments on commit a83322d

Please sign in to comment.