Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

Ty3uK
Copy link

@Ty3uK Ty3uK commented Sep 4, 2023

libsql code heavely based on sqlite code.

Database drop was written manually because you cannot remove remote database.

libsql code heavely based on sqlite code.

Database drop was written manually because you cannot remove remote database.
@amacneil
Copy link
Owner

amacneil commented Sep 6, 2023

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?

@Ty3uK
Copy link
Author

Ty3uK commented Sep 6, 2023

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

Comment on lines +23 to +26
dbmate.RegisterDriver(NewDriver, "http")
dbmate.RegisterDriver(NewDriver, "https")
dbmate.RegisterDriver(NewDriver, "ws")
dbmate.RegisterDriver(NewDriver, "wss")
Copy link
Owner

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this out 🙂

https://github.com/libsql/sqld

Copy link
Collaborator

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().

@emilpriver
Copy link

Hey, Just wondering if there is any update on this topic? :D

@crvouga
Copy link

crvouga commented Nov 12, 2023

Is there any updates on this? Will it be added soon?

Comment on lines +126 to +141
// 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)
}
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants