|
|
@ -2,8 +2,7 @@ import { NcContext } from '.'; |
|
|
|
const mysql = require('mysql2'); |
|
|
|
const mysql = require('mysql2'); |
|
|
|
const { Client } = require('pg'); |
|
|
|
const { Client } = require('pg'); |
|
|
|
|
|
|
|
|
|
|
|
import { PromisedDatabase } from 'promised-sqlite3'; |
|
|
|
import { AsyncDatabase } from 'promised-sqlite3'; |
|
|
|
const sqliteDb = new PromisedDatabase(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isMysql = (context: NcContext) => context.dbType === 'mysql'; |
|
|
|
const isMysql = (context: NcContext) => context.dbType === 'mysql'; |
|
|
|
|
|
|
|
|
|
|
@ -53,12 +52,15 @@ const mysqlExec = async query => { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
async function sqliteExec(query) { |
|
|
|
async function sqliteExec(query) { |
|
|
|
|
|
|
|
try { |
|
|
|
const parallelIndex = process.env.TEST_PARALLEL_INDEX; |
|
|
|
const parallelIndex = process.env.TEST_PARALLEL_INDEX; |
|
|
|
const rootProjectDir = __dirname.replace('/tests/playwright/setup', ''); |
|
|
|
const rootProjectDir = __dirname.replace('/tests/playwright/setup', ''); |
|
|
|
await sqliteDb.open(`${rootProjectDir}/packages/nocodb/test_sakila_${parallelIndex}.db`); |
|
|
|
const sqliteDb = await AsyncDatabase.open(`${rootProjectDir}/packages/nocodb/test_sakila_${parallelIndex}.db`); |
|
|
|
|
|
|
|
|
|
|
|
await sqliteDb.run(query); |
|
|
|
await sqliteDb.run(query); |
|
|
|
await sqliteDb.close(); |
|
|
|
await sqliteDb.close(); |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
console.error(err); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export { sqliteExec, mysqlExec, isMysql, isSqlite, isPg, pgExec }; |
|
|
|
export { sqliteExec, mysqlExec, isMysql, isSqlite, isPg, pgExec }; |
|
|
|