question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support any column type for SQL.js?

See original GitHub issue

Hi there! We’re using sql.js to run our unit tests against our code, and this is actually very convenient (as it allows us doing this even if PgSQL is not available/running on the machine). The best approach would actually be to mock the Connection and its repositories (instead of using an in-mem db), but I did not look for a clean way to do it yet…

However…

Issue type:

[ ] question [ ] bug report [x] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] sqlite [x] sqljs [ ] websql

TypeORM version:

[x] latest [ ] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Connect to a database with type being “sql.js” and with entities containing an entity with a @Column of type “timestamp”.

We can see in many places that SQLite should be able to support any type (including timestamp, also here), as stated in the documentation of the v2), If SQL.js is a port of SQLite, and SQLite is “typeless”, should TypeORM accepts any type for the columns of the entities given to a sql.js database?

At the current time, this is what we get when running our unit tests:

DataTypeNotSupportedError: Data type “timestamp” in “EntityName.createdAt” is not supported by “sqljs” database.

Thanks for this beautiful project!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
pleerockcommented, Feb 5, 2018

@VinceOPS I think it would be great to have a page in our documentation about “How to do testing” with TypeORM, where we provide information about all user cases and what tools we provide to solve their testing problems. It can be a good start point for us to provide all necessary testing infrastructure for users if we start with list of problems user face when he write test for apps using typeorm.

4reactions
pleerockcommented, Feb 5, 2018

Maybe its a better idea to create a separate driver type specially for testing purpose? Which can be based on sqljs

Read more comments on GitHub >

github_iconTop Results From Across the Web

A detailed look at basic SQL.js features - LogRocket Blog
In this detailed tutorial, learn how to use SQL.js to create and query relational databases entirely in your browser.
Read more >
API - Datatypes | Tedious
Type Constant1 JavaScript Result set Parameter Exact numerics Exact numerics Exact numerics Exact numerics bit TYPES.Bit Boolean ✓ ✓ tinyint TYPES.TinyInt Number ✓ ✓
Read more >
SQL Data Types for MySQL, SQL Server, and MS Access
The data type of a column defines what value the column can hold: integer, character, money, date and time, binary, and so on....
Read more >
TypeORM - Amazing ORM for TypeScript and JavaScript (ES7 ...
Column types are database-specific. You can set any column type your database supports. More information on supported column types can be found here....
Read more >
SQL Data Types | DigitalOcean
Note: Not all data types are supported by every relational database vendor. For example, the Oracle database doesn't support DATETIME ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found