# Database.js not found using forest CLI

**URL:** <https://community.forestadmin.com/t/database-js-not-found-using-forest-cli/4093>\
**Category:** Help me!\
**Tags:** typescript\
**Created:** [January 26, 2022, 3:03pm UTC](https://community.forestadmin.com/t/database-js-not-found-using-forest-cli/4093 "2022-01-26T15:03:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fannie\_Yan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/fannie_yan/32/3941_2.png) [@Fannie\_Yan](https://community.forestadmin.com/u/Fannie_Yan)\
**Post date:** [January 26, 2022, 3:03pm UTC](https://community.forestadmin.com/t/database-js-not-found-using-forest-cli/4093/1 "2022-01-26T15:03:36Z")

</div>

## Feature(s) impacted

Forest CLI does not find database.ts file when using `forest schema:update` command after migrating to Typescript (it looks for database.js instead).

## Observed behavior

We are trying to migrate our Sequelize files to Typescript using [this doc]([Migrate Sequelize files | Woodshop for old agent generation](https://docs.forestadmin.com/woodshop/how-tos/translate-your-project-into-typescript/v8/migrate-sequelize-files) 2).  
We migrated middlewares/forestadmin, models/index, config/databases and some model files to Typescript, but when we try to use the command `forest schema:update` in our console, it is followed with this error :  
`× The configuration file "/Users/userName/projectName/backoffice/config/databases.js" does not exist.`

I found [this issue](https://community.forestadmin.com/t/typescript-migration-sequelize/3687) that looked similar but the solution did not work.

## Expected behavior

`forest schema:update` generates new files if there is a new table in the database.

## Context

`models/index.ts`

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/4/45f4957f3faaf98423725dc58bdf61f6c89cb3dc.png)

`config/databases.ts`

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/a/a2dd3f9bd093cfb85d4ff5ece717efdbab4443a7.png)

`tsconfig.json`

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/3/3c955582f0629d22cfc4df7534a3f344d7cd3e22.png)

---

<div class="post-metadata">

**Author:** ![Sliman\_Medini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/sliman_medini/32/19_2.png) [@Sliman\_Medini](https://community.forestadmin.com/u/Sliman_Medini)\
**Post date:** [January 27, 2022, 9:21am UTC](https://community.forestadmin.com/t/database-js-not-found-using-forest-cli/4093/2 "2022-01-27T09:21:22Z")

</div>

Hello @Fannie_Yan,

Is it working when you turn databases.ts back to databases.js?

Regards

---

<div class="post-metadata">

**Author:** ![anon79585656](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@anon79585656](https://community.forestadmin.com/u/anon79585656)\
**Post date:** [January 27, 2022, 10:02am UTC](https://community.forestadmin.com/t/database-js-not-found-using-forest-cli/4093/3 "2022-01-27T10:02:41Z")

</div>

Hello @Fannie_Yan,

If you look at the inline help for the `schema:update` command, you will find the `config` option.  
Can you please try it with the path to your database file and see if all is working directly?

```javascript
> forest schema:update --help
Refresh your schema by generating files that do not currently exist.

USAGE
  $ forest schema:update

OPTIONS
  -c, --config=config [default: config/databases.js] Database 
                                         configuration file to use.

  -o, --outputDirectory=outputDirectory Output directory where to generate new 
                                         files.

```

---

<div class="post-metadata">

**Author:** ![Fannie\_Yan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/fannie_yan/32/3941_2.png) [@Fannie\_Yan](https://community.forestadmin.com/u/Fannie_Yan)\
**Post date:** [January 27, 2022, 10:34am UTC](https://community.forestadmin.com/t/database-js-not-found-using-forest-cli/4093/4 "2022-01-27T10:34:30Z")

</div>

Hello, thanks to you two for your help !

@Sliman_Medini forest CLI does find databases.js

@anon79585656 Using config option works !

Although, now, I have a new unexpected error when I run the command with config option (it actually is the same error as when I turn databases.ts into databases.js)  
`× An unexpected error occurred. Please reach out for help in our Developers community (https://community.forestadmin.com/) or create a Github issue with following error: Cannot use import statement outside a module`

---

<div class="post-metadata">

**Author:** ![anon79585656](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@anon79585656](https://community.forestadmin.com/u/anon79585656)\
**Post date:** [January 27, 2022, 11:24am UTC](https://community.forestadmin.com/t/database-js-not-found-using-forest-cli/4093/5 "2022-01-27T11:24:35Z")

</div>

@Fannie_Yan

Reading the Forest CLI code, I am not sure having the `databases` file in TypeScript is properly supported.

Using `require` statements in place of imports might fix the issue here.  
If not, can you leave this file in plain Javascript for now?

I’ll share this with the team.
