-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libsql: Add initial support #470
Conversation
libsql code heavely based on sqlite code. Database drop was written manually because you cannot remove remote database.
Never heard of libQSL before. The github page says that they will maintain 100% compatibility with the file format and API, so why is a new driver needed? |
Because libSQL also allows you to use remote db over http/ws/grpc. Check Turso UPD: Not libSQL itself but sqld |
dbmate.RegisterDriver(NewDriver, "http") | ||
dbmate.RegisterDriver(NewDriver, "https") | ||
dbmate.RegisterDriver(NewDriver, "ws") | ||
dbmate.RegisterDriver(NewDriver, "wss") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh? why is it accessible over http + websocket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this out 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registering the very generic http
, https
, ws
and wss
to this driver is probably going to bite us in the future. I would rather see us register libsql+http
, libsql+https
, libsql+ws
and libsql+wss
and peel off the libsql+
prefix inside ConnectionString()
.
Hey, Just wondering if there is any update on this topic? :D |
Is there any updates on this? Will it be added soon? |
// DumpSchema returns the current database schema | ||
func (drv *Driver) DumpSchema(db *sql.DB) ([]byte, error) { | ||
path := ConnectionString(drv.databaseURL) | ||
schema, err := dbutil.RunCommand("libsql-shell", path, "-e", ".schema") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
migrations, err := drv.schemaMigrationsDump(db) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
schema = append(schema, migrations...) | ||
return dbutil.TrimLeadingSQLComments(schema) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't currently work:
# dist/dbmate -u $LIBSQL_TEST_URL -d testdata/db/migrations dump
Error: Error: 'tls' usage forbidden. Please use 'WithTls' option instead
libsql code heavely based on sqlite code.
Database drop was written manually because you cannot remove remote database.