On Monday, January 23, 2017 at 6:52:10 AM UTC-8, Benoit Tigeot wrote:
>
> Hello
>
> I have something similar to :
> Sequel.migration do
> up do
> run <<-SQL
> CREATE SERVER foreign_server
> FOREIGN DATA WRAPPER postgres_fdw
> OPTIONS (host "#{ENV['DATABASE_HOST']}",
> port "5439',
> dbname '#{ENV['DATABASE_NAME']}",
> sslmode 'require');
> end
>
> But ENV variables doesn't seems to be read. Is is possible to do this?
>
> Thanks
>
Assuming that ENV is set correctly, and you have the correct SQL, I don't
see any reason it shouldn't work. There are definite issues with the
current SQL you are providing, such as the mismatched quoting around port
and dbname.
In any case, this seems like a bad idea to me. Migrations are not supposed
to depend upon the environment. If you just want to run that SQL on the
database, do:
DB.run <<-SQL
There's no need to create a migration for it. If you do want to create a
migration, I would change things so that you output a migration file that
does not depend on the environment, then run that.
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.