db_copy_table method: when we are splitting the field data tables per entity type in the D7->D8 upgrade then there is nothing to create the D8 tables from except the existing tables and so we need to copy them.
Introduce a db_copy_table function, and a copyTable on Schema.
Implementation is per DB:
In MySQL this is
CREATE TABLE dst LIKE src
In SQLite we could read the definition of src by
SELECT sql FROM sqlite_master WHERE tbl_name='src' and then massage it. We need to deal with CREATE TABLE and CREATE INDEX separately but it is definitely doable. For CREATE TABLE, just change the tablename, for CREATE INDEX search-replace the indexname if it didn't change, prefix with dst_, and search-replace the tablename.
In PostgreSQL we can do
CREATE TABLE dst (LIKE src INCLUDING ALL)
MSSQL is a huge problem but I talked to Damien and he said go ahead and he will deal with it. (Note that INSERT ... SELECT doesn't copy indexes, contraints and the like.)
Oracle has an SQLite-like
SELECT dbms_metadata.get_ddl( 'TABLE', 'src' ) FROM DUAL; so I am less worried than MSSQL.
User interface changes
We are adding a new function / method. Even backportable if we want.
|PASSED: [[SimpleTest]]: [MySQL] 57,839 pass(es).|
|PASSED: [[SimpleTest]]: [MySQL] 58,086 pass(es).|
|PASSED: [[SimpleTest]]: [MySQL] 57,635 pass(es).|