hwakabh / 6ow3idgirl.com

Official Homepage of 6ow3idgirl
https://6ow3idgirl.com/
MIT License
0 stars 0 forks source link

feat(models): implement loading fixtures #101

Closed hwakabh closed 2 months ago

hwakabh commented 2 months ago

AsIs

We do not have any features of adding default data to MySQL database, so that we need to write & execute SQLs for testing features using database connections. As this task would take so much times, and also for the declarative coding it is better to write default data down as code basis, which we can load to MySQL database with a few command.

ToDo

(Optional) Acceptance criteria

Confirm that we can add default values to MySQL tables with executing a few command

(Optional) Additional contexts

N/A

hwakabh commented 2 months ago

For loading fixtures data, there are several packages we can use with TypeORM and its MySQL backend.

Comparing them, typeorm-fixtures seems to be generally a CLI-based tools, while factory.ts is implemented by pure TypeScript so that we need to add them into our code bases. For the purpose of declarative coding, the format of the default data, which would be inserted into MySQL tables, would be better with YAML instead of TypeScript, so we decided to adopt CLI-based typeorm-fixtures here.