#265 open

prefix table names in the database

Reported by Pascal | March 30th, 2009 @ 12:08 AM

With all those engines creating tables in the database, the 'regular' app table names may clash with those.

An example: my app needs an Activity model with a 'activities' table, but one engine already uses that table name.

I propose to re-base every model classes in adva to a class named like Adva::ActiveRecordBase which will look like this:

module Adva
  class ActiveRecordBase < ActiveRecord::Base
    def self.table_name_prefix

With this new base class, every adva model will use a table name prefix (thanx to AR).

Note that I put the class in the Adva module, I think every adva models should also be namedspaced, so not only the tablenames are but also the model classes.

Thanx for listening.


Comments and changes to this ticket

  • Clemens Kofler

    Clemens Kofler March 30th, 2009 @ 10:27 PM

    This sounds like a pretty good idea to me. We should definitely look into that. Thanks for suggesting it, Pascal!

  • Marko Seppä

    Marko Seppä June 18th, 2009 @ 04:21 PM

    • State changed from “new” to “open”

    Added to product backlog as 'namespacing adva-cms'.

  • Pascal

    Pascal June 18th, 2009 @ 09:37 PM

    BTW, I implemented such a system in an engine I developed.
    For the base class to act correctly with STI we need also to tell AR it's an abstract class.
    So here is the revised base class:

    module Adva

    class ActiveRecordBase < ActiveRecord::Base
      def self.table_name_prefix
      self.abstract_class = true


    Concerning namespacing the adva classes such as the models, I also did implement that, I had issues when specifying associations on the models. To work around these issues I had to add the :class_name options to every association to include the namespace, like:
    module Adva

    class Section < ActiveRecordBase
      has_many :articles, :class_names => 'Adva::Article'


    I stay tuned.



  • meocatshirt

    meocatshirt March 27th, 2021 @ 04:03 PM

    Placeit has lots of puppy T-blouse templates and cool shirt ideas to be had to choose from, together with the only beneath: If you are seeking to grow your on line store or simply want to branch out into something new, there’s continually the possibility of starting a business of custom-designed products. ew people cat shirt There are severa fulfillment apps available for Shopify which include dropshipping from Chinese shops and all that.

  • Erika Maer

    Erika Maer April 27th, 2021 @ 06:42 PM

    Is it Academized a safe writing service for me? I want to get more information about this company and its writers. Who will tell essayservices.review ?

  • Coretechnology

    Coretechnology June 17th, 2021 @ 10:33 AM

    Save your PC components from failing and yourself from the headache of rebuilding your PC from scratch. We rounded up the high-quality motherboards in the marketplace for you. https://bestmotherboard.net/ Whether you’re setting out to construct a PC to rival the satisfactory PCs or sincerely upgrading your current one, we’ll locate you a quality board.

  • mediaagency

    mediaagency June 19th, 2021 @ 09:33 AM

    For this, an awesome advertising package deal should consist of content material writing and programs. The content created have to be of high first-rate and it should be engaging. There need to be a risk for the content to develop with time. social media marketing companies in mumbai Besides, your content material can by no means rule without being search engine optimization pleasant. So, choose the enterprise which could offer you with the most interactive and expert content. Enquire the marketing crew and the professionalism of the writers.

  • scanmykitchen

    scanmykitchen August 11th, 2021 @ 12:50 PM

    In regards to the alternative intended benefits of ingesting celery juice to https://scanmykitchen.com/best-juicers-for-celery/
    assist reverse continual diseases inclusive of liver sickness, high blood pressure, acid reflux, or heart sickness, I could recommend you to talk over with your healthcare provider considering the fact that there just isn’t enough clinical evidence to support the ones claims.

  • getrealad

    getrealad August 14th, 2021 @ 11:28 AM

    First of all, the quantity spent on real property marketing will rely totally on your income and the resources you have at your disposal. real estate marketing agency Most marketers suggest spending about 10% of your commissions on advertising. You need to find the advertising finances that works for you. This leaves you to don't forget your average commission on income, the common final sales fee of the houses you promote and the extent of transactions performed in every area and year.

  • picobudspro

    picobudspro September 8th, 2021 @ 11:07 AM

    Do you have trouble listening to surely in noisy environments? Do you have got problem listening to a legitimate or a voice at more distances? Do you've got difficulty communicating with other humans because of your hearing loss? Well, quite a few humans feel embarrassed about listening to loss. PicoBuds However, it's miles a completely commonplace condition this is present in a third of adults global.

  • Linda Gilbert

    Linda Gilbert September 9th, 2021 @ 04:49 PM

    If it's taking more work to vacuum your house, it's probably time to replace the vacuum agitator belt. The good news is you can do it yourself in about fifteen minutes with two screwdrivers. Read at For Comfy Home

  • Matkaz

    Matkaz October 13th, 2021 @ 07:53 AM

    Time Bazar Khiladi 420, Sona Matka , Kalyan Matka Boss 440, Matka India Net. We Delivers Daily Or Weekly Indian Satta Fix Ank Otg. Matka One, Simple Matka Guessing Param Matka Guessing Trick 143 Surya Alex. Similar Key Tags Rae Boss Matka, Matka Boss, Satta Boss.

  • cordlesshairclip

    cordlesshairclip November 5th, 2021 @ 08:57 AM

    The package comes with a beard trimmer with blade protect, a frame trimmer head, a hair trimmer head, a precision trimmer head, a nostril trimmer head, charger, charging dock, Best cordless hair clippers six guide combs, a styling comb, cleaning brush, storage pouch and commands. Wahl is usually called a main emblem for men’s beard and hair trimmers, and this wireless hair clipper lives as much as the agency’s standards of excellent, strength, and precision.

  • Colleen Camacho

    Colleen Camacho March 17th, 2022 @ 07:07 PM

    you're using has access to the information_schema DB. This isn't always the case. The quickest way to see a list of columns for a table is to use DESCRIBE.

    DESCRIBE [table name]

    This is essentially a shortcut for SHOW COLUMNS, which does in fact exist in MySQL 5.5 and 5.6.

    SHOW COLUMNS FROM [table name]

    The difference is that with SHOW COLUMNS, you have more options, like showing columns from a specific DB and using LIKE to display a list of columns using tabletypes. This is especially useful if you have a table with a lot of columns that have similar names or names that contain prefixes/suffixes. For example,

    SHOW COLUMNS FROM Customer FROM ShoppingCart LIKE 'user_%'

    To extend on what Greg said, and if you have access, you can also use

    SELECT COLUMN_NAME FROM information_schema.columns WHERE table_schema='[database]' AND table_name='[table_name]'


    SELECT COLUMN_NAME FROM information_schema.columns WHERE table_schema='[database]' AND table_name='[table_name]' AND COLUMN_NAME LIKE '[wildcard]'
    This question doesn't really make sense. A website is a collection of html pages whereas a database is a system used to store data. The html pages of a website may be populated with data that is stored in a MySQL database, but that doesn't equate to the MySQL database being “on” the website.

    Now in MySQL, a “database” is literally (and I do mean literally) a directory (also called a folder). It can simply be thought of as a name given to a collection of tables. A MySQL instance can have many databases and querying tables in (or across) different databases is accomplished by prefixing table names with the database name and a “.”. It is even possible to JOIN tables across different instances of MySQL, using the federated engine.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<p>Cutting edge cms, blog, wiki, forum ... plattform.</p>

<p>Find the code on <a href="http://github.com/svenfuchs/adva_cms/tree/master">GitHub: adva cms</a></p>

<p>Part of the business application framework <a href="http://www.advabest.org/">adva best</a>.</p>