lujakob/nestjs-realworld-example-app SQLite port by Ciro Santilli 34 Updated 2024-12-15 +Created 1970-01-01
Tried a quick port to SQLite to get rid of annoying local databases for development, but failed, at c1c2cc4e448b279ff083272df1ac50d20c3304faandthen:fails with:Attempt to hack it:and after that it seems to run.
npm install sqlite3 --save-dev
{
"type": "sqlite",
"database": "db.sqlite3",
"entities": ["src/**/**.entity{.ts,.js}"],
"synchronize": true
}
npm start
DataTypeNotSupportedError: Data type "timestamp" in "ArticleEntity.created" is not supported by "sqlite" database.
--- a/src/article/article.entity.ts
+++ b/src/article/article.entity.ts
@@ -20,10 +20,10 @@ export class ArticleEntity {
@Column({default: ''})
body: string;
- @Column({ type: 'timestamp', default: () => "CURRENT_TIMESTAMP"})
+ @Column({ default: () => "CURRENT_TIMESTAMP"})
created: Date;
- @Column({ type: 'timestamp', default: () => "CURRENT_TIMESTAMP"})
+ @Column({ default: () => "CURRENT_TIMESTAMP"})
updated: Date;
I can signup and login, terrible error reporting as usual, make sure to use long enough usernames/passwords.
However, article creation fails with:
Unhandled Rejection (TypeError): Cannot read property 'slug' of undefined