On Friday, April 18, 2014 4:06:02 PM UTC-7, Jarrod Manzer wrote: > > I have been trying to create a Sequel migration file using the pg_inet > datatypes without success. Can someone provide an example of how to do so? > Something along the lines of: > > Sequel.migration do > up do > alter_table(:ipaddresses) do > add_column :address, ???? >
You use the database's type, as either a symbol or string (see http://sequel.jeremyevans.net/rdoc/files/doc/schema_modification_rdoc.html): add_column :address, :inet Note that the Sequel pg_* extensions do not create types in the database, you need to consult PostgreSQL's documentation for information on PostgreSQL type names (e.g. http://www.postgresql.org/docs/9.3/static/datatype-net-types.html#DATATYPE-INET). As a second question, do I have to use the 'DB' global variable to load the > extension (DB.extension :pg_inet) in that migration script? > I tried finding the answer but there seems to be limited documentation on > the subject. > Not in the migration, since you aren't using any extension specific features in the migration. Note that DB is a constant and not a global variable. In ruby, global variables always start with $. 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 http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
