Closed (outdated)
Project:
Drupal core
Version:
11.x-dev
Component:
database system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Apr 2009 at 02:08 UTC
Updated:
9 Oct 2025 at 17:07 UTC
Jump to comment: Most recent
Comments
Comment #1
boombatower commentedHere is an excerpt from how I accomplished this in the other patch. (This is not intended to be finished code, but at the time I had no better way to do it)
This function assumes the tables schema has been copied. We probably should have either two methods or parameterize it to allow for the creation of just the schema and or data as well. In most cases we should just be able to create schema using schema API...so maybe just data?
Comment #2
damien tournoud commentedCopying a whole table might be useful (it certainly is), but I think we should rather implement "whole schema" (in the Schema API sense) copying. This is the only way we could significantly speed-up tests on SQLite (by simply copying the whole database file).
Comment #3
Crell commentedTable-level cloning is also useful if we ever get around to implementing optimized databases for selected tables, such as system or the registry tables. For that, we'd need a clean "clone this table from this connection to this connection" operation.
Comment #4
boombatower commentedFor a number of cases in SimpleTest I need a clone table that copies data (preferably not schema as well), but I should write it differently. The main two things I am trying to accomplish are:
1) Tuning simpletest by creating skeleton databases and re-using them. (schema only initially)
2) Copying from a base database, could be a plain drupal install, or backed up version of live site for configuration testing (data only).
Currently I do all schema creation using the built in schema handling code (and seems sufficient), only time you may want raw copy of schema is if you do not know what the schema of the table is, which is not the problem in my case.
So if we could get a consistent copy data function that would be great.
In general, copy database functionality would work, but would be less tuned (depending on implementation) then only copying data. If we do things like copy database files I have no idea, but if done in queries then I would assume data only would be faster.
As a note: the code I have works, but as suggested (and I thought about) it should be in db layer.
Comment #5
Crell commentedMore robust connection handling will have to wait, sadly.
Comment #6
rfaysubscribe
Comment #7
neilnz commentedDatabase duplication on Postgres (in a controlled environment) can be optimised using template DBs.
See http://www.postgresql.org/docs/8.3/interactive/manage-ag-templatedbs.html
Every DB in postgres is actually based on a template, but the default template is empty.
Comment #8
jhedstromComment #24
smustgrave commentedThank you for sharing your idea for improving Drupal.
We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #25
smustgrave commentedSince there's been no follow up and as a feature request going to close out. Can always be re-opened
Thanks all!