mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) add minimal support for activation keys
Summary: For grist-ee, expect an activation key in environment variable `GRIST_ACTIVATION` or in a file pointed to by `GRIST_ACTIVATION_FILE`. In absence of key, start a 30-day trial, during which a banner is shown. Once trial expires, installation goes into document-read-only mode. Test Plan: added a test Reviewers: dsagal Reviewed By: dsagal Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3426
This commit is contained in:
39
app/gen-server/migration/1652273656610-Activations.ts
Normal file
39
app/gen-server/migration/1652273656610-Activations.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import {MigrationInterface, QueryRunner, Table} from 'typeorm';
|
||||
|
||||
export class Activations1652273656610 implements MigrationInterface {
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
// created_at and updated_at code is based on *-Initial.ts
|
||||
const sqlite = queryRunner.connection.driver.options.type === 'sqlite';
|
||||
const datetime = sqlite ? "datetime" : "timestamp with time zone";
|
||||
const now = "now()";
|
||||
await queryRunner.createTable(new Table({
|
||||
name: 'activations',
|
||||
columns: [
|
||||
{
|
||||
name: "id",
|
||||
type: "varchar",
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
name: "key",
|
||||
type: "varchar",
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
name: "created_at",
|
||||
type: datetime,
|
||||
default: now
|
||||
},
|
||||
{
|
||||
name: "updated_at",
|
||||
type: datetime,
|
||||
default: now
|
||||
},
|
||||
]}));
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.dropTable('activations');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user