Database and Migration

All migrations path

├── node_modules
├── mail-templates
├── migrations
│   ├── 1661868238821-usersTable.ts              # Users table
│   ├── 1661868315626-subscriptionsTable.ts      # Subscriptions table
│   ├── 1708974949319-BlogpostTable.ts           # Blogposts table
│   ├── 1709027986137-FileUploadTable.ts         # File upload table

Set environnements variables in .env

TYPEORM_HOST=
TYPEORM_PORT=
TYPEORM_USERNAME=
TYPEORM_PASSWORD=
TYPEORM_DATABASE=

Run the migration

npx ts-node ./node_modules/.bin/typeorm  migration:run -d ./datasource.ts

Create a migration

npx typeorm migration:create migrations/nameOfTable

Last updated