-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
(migratus/initialize config) #85
Comments
I think that would be a reasonable idea. It sounds like it would just be a matter of having an |
Yep, exactly. |
Yeah I think that would be easy enough to add. I'll take a look when I get a chance, but if it's something you think you'd like to try to add I'm open to a pr as well. |
I just checked in an update that adds an |
I'm getting an error and I think it has to do with the connection string. When the DB/schema is present, connection string is something like |
Yeah, looks like you would need to use a different connection for that. |
Yep. Makes sense. Need to connect without selecting a DB/Schema. Might want to add that to the doc string and/or regular documentation. |
Yup, I'll update the docs once I push out the new release. So, once you use a different connection string everything is working as expected then? |
Actually, no. When I run the normal migration, I get an error I would expect ( Not 100% sure but things look correct in my client code. |
Currently, you have to call (let [store (proto/make-store config)]
(proto/connect store)
(proto/init store)
(proto/disconnect store)) Perhaps |
I see. I was calling |
different error but still an error :-(. Getting |
Hmm, take a look here at how the test is setup. The config in the test looks as follows: (def config {:store :database
:migration-dir "migrations/"
:migration-table-name "foo_bar"
:db {:classname "org.h2.Driver"
:subprotocol "h2"
:subname db-store}}) |
Configuration options look correct. Some values are different. I'm using |
Yeah, clojure.java.jdbc had breaking changes in the API, and |
Yeah. Saw that in the log file in the line before the error. Is it possible to turn off migration table creation for the |
You could just create the migration table manually. That step will be skipped when it exists. |
I don't think I can exactly. The migration table lives in the schema that I'm trying to create with the init file. I could create it in the init file but that is less than ideal and, more importantly, I'm not sure it will work. Is it testing for the existence of the migration table prior to running the init file? Even if it works, probably don't want to force a user to create a book keeping table that is an implementation detail to the library. |
That's a good point actually, the |
ok just pushed a fix for that |
The schema creation was successful, so that is good. However, when I tried to follow that with a run of my migrations, they failed with the same error the init was getting before ( |
Right, but that's a problem with the library version. The workaround in this case would be to create the migration table in the schema creation script. |
Okay. I can do that. When you say library version, you mean the JDBC version I'm using? |
Just tried to create CREATE SCHEMA database;
--;;
CREATE TABLE database.schema_migrations; Gives a very unhelpful (love MySQL error reporting!) SQL syntax error |
Yeah that part I'm not sure about. I'm not too familiar with MySQL. |
@MafcoCinco I was trying to do the same thing with MySQL. Oddly enough, when I put the The multi-command syntax works fine when I do it that way, but errors when I have it in the |
@hyleung Thanks for the update. I will give that a try. |
@MafcoCinco btw, I should add - you might want to use a different config to create the schema vs. execute the migrations, cos there'll be a table created to track |
@hyleung I met similar error at in |
Perhaps something like templating the scripts like here: https://github.com/rails/rails/blob/master/activerecord/Rakefile#L179 ? |
I'm having trouble with the difference in connections as well. When running init.sql I need to use the subname |
Yeah that sounds reasonable to me. Might be better to just have a separate optional |
First, Migratus has been great. Tight and simple migration tool.
Having said that, I would like the ability to create the database itself. Currently, AFAIK, the user must initialize the database (schema) outside the scope of the project (i.e. CREATE SCHEMA <schema_name>). Other migration tools that I have used (specifically in the context of Ruby on Rails) provide a
setup
orinitialize
function which allows the user to generate the schema(s) from a clean DB. Would be awesome to have in Migratus as it would provide a uniform interface for initializing the DB and make the project more self contained.If I'm missing something and this is already possible, I apologize.
The text was updated successfully, but these errors were encountered: