Copy Data Tables Structure With Optional Data

Would be handy to be able to selectively copy a data table structure from another app into the current app, optionally with (default) data.

I know I can export my app in its entirety and copy the data with it, but that’s not the same thing for me. Neither is sharing the same table.

EDIT - or a way to create them in code?

7 Likes

That sounds v handy…!

Upvoted this. Now that we can create multiple databases (e.g., prod, test, dev), and share tables between them (and other apps), there needs to be an easier way to evolve these structures.

Typically, one creates a new table in dev, then replicates the table (possibly with data) to test, and finally (when all tests pass) to prod. Currently, this is a manual (and therefore error-prone) process.

1 Like

When you say “selectively copy a data table structure”, what do you mean here? Can you provide an example?

(I have a suspicion that what you’re looking for can be accomplished with the source-code-side data table schema and the “resolve differences” dialog in the IDE, but I want to check what you’re looking for first!)

In my case it means, create a new table with exactly the same column definitions as some existing table, with the option to copy rows.

Something like SQL’s “CREATE TABLE X AS SELECT … FROM Y”, only the SELECT doesn’t actually [need to] generate any actual rows.

Edit: for what it’s worth, I have the same suspicion, at least for creating new, empty tables. And if it’s an officially-sanctioned technique, that’s fine.