I would like the ability to offer a suggestion for the database name that then gets passed to the provision module for new site creation. My idea is that there would be another field on the the new site page where one could enter the desired database name. This would be passed to provision, which would use it to create the new database. Provision would do something similar to what it does now, to make sure that there are no duplicates and appending a number to the end of the suggested name until a unique name is achieved.

Thanks,

Comments

Anonymous’s picture

See #545840: running install command from command prompt creates better DB name

It may be that we add an optional field, however we run into risks with MySQL stripping characters from database names that may cause namespace collisions with other databases.

meecect’s picture

what if we include a filed with instructions, similar to many system fields, that has instructions for creating 'machine readable names', and only allow lowercase (or maybe mixed case) characters and numbers and maybe underscores and dashes. Then make that field validate with those characters?

Would you accept a patch that implemented that feature?

anarcat’s picture

I would personnally think having a patch that would:

1. produce the database name based on the site name
2. produce always unique names
3. avoid collisions with existing sites (ie. support cloning and migration properly)
4. support a prefix (ie. we're using "site_" now)

... would have a good chance of getting in.

Anonymous’s picture

This is technically a duplicate of this ancient ticket #448960: allow customizing the "database prefix"

But I'll close the other one as the conversation has been happening here since.

azuledu’s picture

Any progress about this?

I think it would be really useful.

Thanks

adrian’s picture

In aegir head we _only_ use the site's URI to generate the db name now.

since we had to stop using site nid's everywhere, and situations like site cloning made the naming scheme unreliable.

aaronbauman’s picture

StatusFileSize
new1.19 KB

Here's a patch against alpha3, backported from HEAD (as mentioned in #6), that names the database based on the site's URL.

FWIW, if you throw a "db_name" option to drush, you can specify any db name you like.

provision install mysite.example.com --db_name=mysiteexample

I would think that modifying the node form would be left to contrib, so as not to add clutter.

mcdruid’s picture

StatusFileSize
new1.25 KB

same patch as #7 re-rolled for 0.4-alpha8

SeanBannister’s picture

sub

realityloop’s picture

With the new naming structure that came as part of Aegir 0.4 alpha 9, this seems totally unnecessary as you can now easily tell by looking at the DB name which site it belongs to.

aaronbauman’s picture

I, too, am satisfied with the solution in 0.4 alpha 9.

adrian’s picture

Status: Active » Fixed

Im going to mark this as fixed, because i think we've solved the main issue (ie: noone liking site_X format)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.