On Tuesday, August 11, 2020 at 10:19:46 AM UTC-7, Anant M wrote:
>
> Hi, 
>
> I keep getting kicked off the IRC (connection issues at home) so figured 
> this is a better way to ask a question (thank you so much!):
>
> Migrating a sqlite database to postgresql, and trying to figure out a 
> conversion for the views as this is mostly what we're working with. Is it 
> possible to migrate these/how are they typically migrated?
>

Sequel doesn't have built in support for migrating views. SQLite doesn't 
have a command to provide view definitions.  You may be able to use 
something like the following:

SQLITE_DB.views.each do |name|
  POSTGRESQL_DB.run SQLITE_DB[:sqlite_master].where(:type=>'view', 
:name=>name.to_s).get(:sql).gsub('`', '"')
end

However, if you are using any syntax in your SQLite view that is not 
directly supported by PostgreSQL, it won't work.  The above code only tries 
to fix the identifier quoting differences.

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/9543e70a-21bf-45a0-ac2b-f8fd7dba0d6eo%40googlegroups.com.

Reply via email to