mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Run seeds manually from CLI, prevent knex import issues
This commit is contained in:
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "directus",
|
||||
"version": "0.1.0-preview.4",
|
||||
"version": "0.1.0-preview.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "directus",
|
||||
"version": "0.1.0-preview.5",
|
||||
"version": "0.1.0-preview.6",
|
||||
"description": "Directus",
|
||||
"main": "dist/app.js",
|
||||
"bin": {
|
||||
|
||||
@@ -11,6 +11,9 @@ import { v4 as uuidV4 } from 'uuid';
|
||||
|
||||
import argon2 from 'argon2';
|
||||
|
||||
import { seed as seedCreateTables } from '../../../database/seeds/01-create-tables';
|
||||
import { seed as seedAddSystemRows } from '../../../database/seeds/02-add-system-rows';
|
||||
|
||||
import createDBConnection, { Credentials } from '../../utils/create-db-connection';
|
||||
|
||||
export default async function create(directory: string, options: Record<string, any>) {
|
||||
@@ -43,11 +46,15 @@ export default async function create(directory: string, options: Record<string,
|
||||
await fse.mkdir(path.join(rootPath, 'uploads'));
|
||||
await fse.mkdir(path.join(rootPath, 'extensions'));
|
||||
|
||||
console.log('Adding package.json');
|
||||
|
||||
await execa('npm', ['init', '-y'], {
|
||||
cwd: rootPath,
|
||||
stdin: 'ignore',
|
||||
});
|
||||
|
||||
console.log('Installing Directus');
|
||||
|
||||
await execa('npm', ['install', 'directus@preview', '--production', '--no-optional'], {
|
||||
cwd: rootPath,
|
||||
stdin: 'ignore',
|
||||
@@ -72,7 +79,8 @@ export default async function create(directory: string, options: Record<string,
|
||||
|
||||
const db = createDBConnection(dbClient, credentials);
|
||||
|
||||
await db.seed.run();
|
||||
await seedCreateTables(db);
|
||||
await seedAddSystemRows(db);
|
||||
|
||||
console.log(`Creating the .env file...`);
|
||||
|
||||
|
||||
@@ -22,14 +22,6 @@ for (let [key, value] of Object.entries(process.env)) {
|
||||
const knexConfig: Config = {
|
||||
client: process.env.DB_CLIENT,
|
||||
connection: connectionConfig,
|
||||
migrations: {
|
||||
extension: 'ts',
|
||||
directory: './src/database/migrations',
|
||||
},
|
||||
seeds: {
|
||||
extension: 'ts',
|
||||
directory: './src/database/seeds/',
|
||||
},
|
||||
};
|
||||
|
||||
if (process.env.DB_CLIENT === 'sqlite3') {
|
||||
|
||||
Reference in New Issue
Block a user