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

Question: why is "CREATE DATABASE" not yet implemented? #105

Open
rhighs opened this issue Feb 20, 2024 · 2 comments
Open

Question: why is "CREATE DATABASE" not yet implemented? #105

rhighs opened this issue Feb 20, 2024 · 2 comments

Comments

@rhighs
Copy link

rhighs commented Feb 20, 2024

I have a few tests i wanted to migrate to ramsql. They make use of a create command: CREATE DATABASE <test_name> to leverage tests parallelism, but it got error: "Parsing error near ". Looking at the code this seems to be implemented yet. Is there any specific reason?

If not, I could have a deeper look and open a PR!

@proullon
Copy link
Owner

Hello,

The reason CREATE DATABASE is not implemented is that opening a connection with ramsql on any different connection string will be isolated, like running in a different database.

i.e

db1, _ := db.Open("ramsql", "Test1")
db1, _ := db.Open("ramsql", "Test2")

Now indeed, there may be a case to parse "CREATE DATABASE" and ignore it, to avoid error with pre-existing tests.

@rhighs
Copy link
Author

rhighs commented Feb 27, 2024

Now indeed, there may be a case to parse "CREATE DATABASE" and ignore it, to avoid error with pre-existing tests.

I've tried using it the way you describe it and it works really well. I have some code paths that run migrations files for my tests in a given database, skipping the error would be great. It might be a good idea to track down which tokens are parsed and ignored to avoid errors in a table somewhere. You know, just to document this behavior.

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

No branches or pull requests

2 participants