Sorrm how to add a column to an existing table - scala

I need to add a new column to an existing table, I know I could create a new model and migrate the data over but that wouldn't be idle any other way?

Unfortunately the only other way is to use some administration tool for your database to manually update the schema to match the one for the new model.

Related

Adding new fields in pipeline

How can I add new fields to the schema? We are pulling in records from a SQL database and would like to add a few metadata columns in the pipeline process.
Also, is there a way to use the record duplicator plugin such that the child records have a distinct identifying field? Thanks.

adding new column to postgresql and access

I'm using access as a frontend to a postgresql db, I've inherited it.
I've added a new column to a table in postgresql, but I can't access it in access. Do I need to add the same column in access and define the link or would it do this automatically. Any help is welcomed.
I'm using linked tables, to get the new column to show up I needed to refresh the linked connection.

How do you change a table's schema?

We have a MySQL Workbench project with two tabs (two schemas/two databases).
If we create a table in the first tab, it's attached to the schema
magikweb_dev_igcweb.
If we create a table in the second tab, it's attached to the schema
magikweb_dev_igcweb_archive.
If we copy-paste/duplicate a table from the first tab to the second tab, the resulting table remains in the first schema. How can you change a table's schema?
Each schema is linked with a specific database, so when we use the "Synchronize Model..." feature, it links all the tables properly.
Use the model tab. You can cut out a table from one schema tab and insert it into another.
The cut-and-paste method described in another answer works well for tables with no foreign keys, and for a reasonable number of tables.
An alternative that preserves foreign keys is to export the model as a SQL script, edit it, and then import the new script into a new model.
Using MySQL Workbench v6.3:
File -> Export -> Forward Engineer SQL Script
Carefully edit SQL script. Replace references to one schema with the other, for the tables you want to move. Do this both for CREATE TABLE commands and foreign key references.
File -> New Model
File -> Import -> Reverse Engineer SQL Script
Unfortunately you will then need to recreate any diagrams. But that can be straightforward if you have the original diagram as reference (take a screenshot or export it to PNG or PDF.)
Follow this simple steps (never miss step 4 and 5) :
Open Model Tab
Choose source schema. In my case, I want to copy table users from schema abc_develop_v1 to schema abc_develop_v2 then paste to diagram . So I choose schema abc_develop_v1, right-click table users then Copy 'users'
Go to the targeted schema. In my case is schema abc_develop_v2, right-click then Paste 'users'
Next, copy table users from schema abc_develop_v2. Right-click table users then Copy 'users'
Go to your diagram and Paste 'users'.
That's all. Your table is ready in your diagram with the right schema :-)
Notes: You can double check by double-click on the table in your diagram, and look at the right corner. It will show the Schema name.
I found a less painful way to do this.
Save and backup your diagram and your schema.
Display schema's name before table's names in diagram. This will make the next step easier.
Right-click on the tables which are on the wrong schema, and select "Copy SQL to clipboard". Paste the script in a new SQL window. Repeat for each table you want to migrate.
Edit the script to change the schema name. Watch for any miss in entries, the wrong schema might be a reference at any line. Mine was mydb, which I don't remember creating. Execute the script. Now you have the tables on the right schema.
Synchronize your model. Be sure to check "Update the model" for each missing table, otherwise, the tables will be deleted from the schema :)
Drag'n'drop the newly created tables into the diagram. Then remove the ones which are using the wrong schema. Tip: tables that are not in diagram won't display a dot next to their name.
Optionally, you can delete the faulty schema from the model so this never happens again. Be sure to know what you're doing first!

Altering database structure on Smartface application upgrade

What is the best approach to alter an existing database on Smartface application upgrade?
New version of my app has slightly different database structure (new columns were added).
When upgraded happened GUI-desined datasets are new (with new columns) while existing database is old (without those columns).
Existing database contains user data meaning replacing it with an empty one is not an option.
The following code is not working (column is not added):
Data.execute("ALTER TABLE TableSettings ADD COLUMN NewColumn TEXT;");
Data.execute("UPDATE TableSettings SET NewColumn = 'test is fine';");
Data.DatasetSettings.refresh();
Pls share some ideas how to solve the problem.
During upgrade, if the structure of table is same and has keepDataOnUpdate flag true, data will be kept.
Method1
You may use new table to work with. Copy data from exiting to new one and delete records inside old one. Do not remove old table.
Method2
You may alter table as you do now. For future versions, add some checks to database to avoid re-adding of column by script. Use dynamic dataset to work with that table. Static datasets are tightly bound to table meta during publish; With static dataset you cannot use your new columns.
In future versions of Smartface (expected 4.5 or 4.6) database management will be given to users providing more control on what is on database and more control about update procedures.

Is it possible to create table templates in Filemaker?

I'm using Filemaker Pro 12 and I was wondering if there is a way of creating a template for tables. There are a number of fields I'm placing in my tables that are identical utility-fields like modification time-stamp, active/inactive flags, etc. I was hoping there was a way that I could define the skeleton of each table somehow instead of having to manually add these identical fields every time.
If you are using the Advanced version, you can copy&paste fields among tables/files.
Using the regular version, you can import records from your "default" table and specify [New Table...] as the target table. This will recreate the source table's structure in the target file. The source table does not have to contain any records for this to work.
To expand a little bit on michael-hor257k's answer, if you're using FileMaker Pro Advanced, a good practice is to create a "Default" table that has your core utility fields. When you want to make a new table in Manage Database, instead:
Highlight the Default table,
Copy & Paste the table, then
Rename the new table.