You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Granite::Migrator generates SQL on #drop and #create, and runs it imminently. The possibility of having the migrator export the generated SQL would be nice for use in migration tools like micrate. The generating functionality is already in place, implementing this would just be moving the generating code into create- and drop- _sql methods (names debatable), and using them in place of the current generating code.
I'm using Granite for building a program (i.e. no amber), I'm also quite new to SQL, which is one of the reasons I enjoy Granite so much.
Following the Granite docs on migrating, I stumble upon SQL in the micrate up and down sections, I do not know how Granite interfaces with its tables. Therefore I do not know how to define these migrations, and I take a look at the alternative Granite::Migrator#create and #drop, which both work great, however they seem wholly impractical to use long term, at least compared to micrate.
I hoped I could extract the SQL generated by Granite::Migrator, but seems that's not possible, hence I ask here whether it's a good idea or not to extract the generated code into separate methods. Practical or not it adheres better to the single responsibility principle... Sorry for the spaghetti text.
I'll happily implement this if it's accepted as a good idea.
The text was updated successfully, but these errors were encountered:
tl;dr
Granite::Migrator
generates SQL on#drop
and#create
, and runs it imminently. The possibility of having the migrator export the generated SQL would be nice for use in migration tools likemicrate
. The generating functionality is already in place, implementing this would just be moving the generating code intocreate
- anddrop
-_sql
methods (names debatable), and using them in place of the current generating code.I'm using Granite for building a program (i.e. no amber), I'm also quite new to SQL, which is one of the reasons I enjoy Granite so much.
Following the Granite docs on migrating, I stumble upon SQL in the micrate up and down sections, I do not know how Granite interfaces with its tables. Therefore I do not know how to define these migrations, and I take a look at the alternative
Granite::Migrator#create
and#drop
, which both work great, however they seem wholly impractical to use long term, at least compared tomicrate
.I hoped I could extract the SQL generated by
Granite::Migrator
, but seems that's not possible, hence I ask here whether it's a good idea or not to extract the generated code into separate methods. Practical or not it adheres better to the single responsibility principle... Sorry for the spaghetti text.I'll happily implement this if it's accepted as a good idea.
The text was updated successfully, but these errors were encountered: