Skip to content

Commit

Permalink
Activations: add an enabled_at column
Browse files Browse the repository at this point in the history
For #1140, I considered trying to use the existing fields in a better
way, but because we already use the activations table to store
preferences, we need to keep all of the existing data and its usage
as-is.

The enterprise code will use this new column to decide how long the
trial period should be.
  • Loading branch information
jordigh committed Aug 1, 2024
1 parent 42f696d commit ec46233
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/gen-server/entity/Activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class Activation extends BaseEntity {
@Column({name: 'updated_at', default: () => "CURRENT_TIMESTAMP"})
public updatedAt: Date;

@Column({name: 'enabled_at', nullable: true})
public enabledAt: Date|null;

public checkProperties(props: any): props is Partial<InstallProperties> {
for (const key of Object.keys(props)) {
if (!installPropertyKeys.includes(key)) {
Expand Down
19 changes: 19 additions & 0 deletions app/gen-server/migration/1722529827161-Activation-Enabled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as sqlUtils from "app/gen-server/sqlUtils";
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";

export class ActivationEnabled1722529827161 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
const dbType = queryRunner.connection.driver.options.type;
const datetime = sqlUtils.datetime(dbType);
await queryRunner.addColumn('activations', new TableColumn({
name: 'enabled_at',
type: datetime,
isNullable: true,
}));
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn('activations', 'enabled_at');
}
}

0 comments on commit ec46233

Please sign in to comment.