forked from sequelize/cli
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
What you are doing?
I try to run migration but I keep getting an error which I believe concerns the use of es6
Config.ts Code
import dotEnv from "dotenv";
dotEnv.config();
const {
DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, DATABASE_HOST
} = process.env;
interface SequelizeConfig {
username: string;
password: string;
database: string;
host: string;
dialect: "mysql" | "postgres" | "sqlite" | "mariadb" | "mssql" | undefined;
}
interface DbEnvConfig {
[key: string]: SequelizeConfig;
}
const config: DbEnvConfig = {
development: {
username: DATABASE_USER!,
password: DATABASE_PASSWORD!,
database: DATABASE_NAME!,
host: DATABASE_HOST!,
dialect: "postgres",
},
production: {
username: DATABASE_USER!,
password: DATABASE_PASSWORD!,
database: DATABASE_NAME!,
host: DATABASE_HOST!,
dialect: "postgres",
},
test: {
username: DATABASE_USER!,
password: DATABASE_PASSWORD!,
database: DATABASE_NAME!,
host: DATABASE_HOST!,
dialect: "postgres",
},
};
export default config;What do you expect to happen?
I expect my migrations to run without errors.
What is actually happening?
I am getting Error
ERROR: Error reading "src/dbConfig/config.ts". Error: SyntaxError: Cannot use import statement outside a module
__Dialect: postgres
__Database version: 10
__Sequelize CLI version:^3.2.0-c
__Sequelize version:^5.21.13
Metadata
Metadata
Assignees
Labels
No labels