Re: Table Prefixing

2016-12-01 Thread Elanor Riley
Jeremy, you never cease to amaze. Thank you so much.

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Re: Table Prefixing

2016-12-01 Thread Jeremy Evans
On Thursday, December 1, 2016 at 6:45:31 PM UTC-8, Elanor Riley wrote:
>
> Hello!
> I am writing an app that is limited to work within an existing database, 
> therefore some of the table names may collide. Is there a way to assign a 
> table prefix so that migrations / etc create, for example *newapp_users* 
> rather than *users*?
>
> For example, active record has table_name_prefix that you can set.
>
> I'm using MySQL if that makes any difference. Thank you!
>

You can override Sequel::Model.implicit_table_name to set the table name to 
use for the model if one isn't specified explicitly:

  def (Sequel::Model).implicit_table_name
:"newapp_#{super}"
  end

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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Table Prefixing

2016-12-01 Thread Elanor Riley
Hello!
I am writing an app that is limited to work within an existing database, 
therefore some of the table names may collide. Is there a way to assign a 
table prefix so that migrations / etc create, for example *newapp_users* 
rather than *users*?

For example, active record has table_name_prefix that you can set.

I'm using MySQL if that makes any difference. Thank you!

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.