mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-26 15:15:58 +00:00
test: add harness and some examples (#2941)
* test: add harness and some examples * feat: tests ran on pr
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
import { existsSync, readFileSync } from 'fs';
|
||||
import { basename, extname, join, resolve } from 'path';
|
||||
import { createContext, runInContext } from 'vm';
|
||||
import { AbstractDatabaseClient, type WriteResult } from './DatabaseClient';
|
||||
import type { IConfig } from '../../types';
|
||||
import { AbstractDatabaseClient, type WriteResult } from './DatabaseClient';
|
||||
|
||||
const MIGRATIONS_DIR = resolve(__dirname, './migrations/sqlite');
|
||||
|
||||
@@ -76,6 +76,7 @@ const AVAILABLE_MIGRATIONS: [number, string[]][] = [
|
||||
[41, ['0045_user_oidc_providers.sql']],
|
||||
[42, ['0046_is-private-apps.sql']],
|
||||
[43, ['0047_app-url-updates.sql']],
|
||||
[44, ['0048_old-app-names-unique-tuple.sql']],
|
||||
];
|
||||
|
||||
export class SqliteDatabaseClient extends AbstractDatabaseClient {
|
||||
@@ -95,7 +96,9 @@ export class SqliteDatabaseClient extends AbstractDatabaseClient {
|
||||
override async onServerStart(): Promise<void> {
|
||||
const Database = (await import('better-sqlite3')).default;
|
||||
|
||||
const dbPath = this.config.database?.path ?? ':memory:';
|
||||
const dbPath = this.config.database?.inMemory
|
||||
? ':memory:'
|
||||
: (this.config.database?.path ?? ':memory:');
|
||||
const isNew = dbPath === ':memory:' || !existsSync(dbPath);
|
||||
|
||||
this.db = new Database(dbPath);
|
||||
@@ -453,6 +456,13 @@ export class SqliteDatabaseClient extends AbstractDatabaseClient {
|
||||
version: 43,
|
||||
check: () => this.hasColumn('apps', 'is_private'),
|
||||
},
|
||||
{
|
||||
version: 44,
|
||||
check: () =>
|
||||
this.hasRow(
|
||||
"SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'old_app_names' AND sql LIKE '%UNIQUE%app_uid%name%'",
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
let inferredUserVersion = 0;
|
||||
|
||||
Reference in New Issue
Block a user