On Thursday, January 2, 2020 at 10:45:31 AM UTC-8, John Hogarty - Ho Gi 
Hung wrote:
>
> Howdy all,
>
> This might be something simple I am missing, but after searching the docs 
> and github repo for a few hours and not finding an answer, I thought I 
> would ask here.
>
> I have some migrations that execute against either an Oracle DB or MySQL 
> DB.  Recently we discovered someone manually added migrations to some 
> client tables.  I'm trying to create migrations to synchronize these 
> changes.   Is there a way to check, when running migrations, to see if an 
> index already exists?  I only want to apply the migration changes if the 
> indexes do not exist? If they do exist, I want to make sure the version 
> value in schema_info matches the current migration.
>
> Currently what I am doing is adding a begin/rescue block to the migration 
> change/do block.  But I feel there has to be a better way.  Should any of 
> my add_index calls fail, I abort the migration and display some errors to 
> the terminal.
>

Sequel does not have code to check if an index already exists. It does have 
code to see if a table already exists. I'm not sure there is a better way 
to do what you are doing, unless you want to use database-specific queries 
to determine whether the index exists before adding it.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/1e980805-2d48-4af7-a3c7-fa71e6ac593f%40googlegroups.com.

Reply via email to