Comments (7)
closing the issue since its a drizzle issue with their generated sql
from libsql.
Thank you for bringing up the issue @kelbyfaessler . Would you have a code / SQL that reproduces the issue?
from libsql.
I played around with the generated SQL and figured out the issue.
The issue is in this part of a table definition
CREATE TABLE `mytable` (
...
`created_at` text DEFAULT strftime('%Y-%m-%dT%H:%M:%fZ', 'now') NOT NULL,
...
);
If I put parens around the strftime call, then it works
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
from libsql.
@kelbyfaessler Ρan you show the drizzle schema you are using?
from libsql.
@AndriiSherman the line in the schema looks like this:
createdAt: text("created_at").notNull().default(sql`strftime('%Y-%m-%dT%H:%M:%fZ', 'now')`),
which means its not a drizzle issue and rather issue with my own code, right? Since I could insert the parens like so
createdAt: text("created_at").notNull().default(sql`(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`),
from libsql.
According to my understanding you're right @kelbyfaessler. This is an issue with the code not drizzle itself but @AndriiSherman will know better.
from libsql.
Author
Yes, so the case here is that if you are using the sql
template in the drizzle schema, we can't know exactly what is there because it can be basically anything. It's done to not block you from using anything you need while we are implementing first-class support for a specific feature. So it means anything that is in the sql
template will be added after the default as-is, so it is your responsibility to put the right code there, same as you would put in raw sql DDL statement after DEFAULT
from libsql.
Related Issues (20)
- Add `query_batch` that returns rows for batch requests
- libsql returning 502 on prod HOT 1
- Stack overflow exception then trying to get sqlite schema on an empty turso database on Windows (only) HOT 1
- No runtime available error HOT 1
- SQLite allows foreign keys on non-existing columns?
- Request: Linux ARM binaries of libsql-server HOT 1
- Add metrics about rows returned
- Query cancellation support
- Query timing?
- libsql `de::from_row` does not support serde flatten
- Cloudflare Worker issue
- Cgo Driver like mattn/go-sqlite3? HOT 1
- Insert queries take an enormous amount of time with replicas HOT 1
- Support shared in memory DBs
- Expose libsql version in c binding
- Inconsistent/incorrect savepoint results in remote and remote_replica connections
- Turso -schema DBs don't work with Goose migrations HOT 6
- iOS/Android support HOT 6
- Unix sockets for embedded libsql
- SELECT Query still does a FULL TABLE SCAN. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsql.