Comment:
Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE
Creates in this server a new table with the specified name.
Table Row (tr)
id
prs
Table Cell (td)
Parameters {String} tableName – The name of the table to create.
Table Row (tr)
id
ret
Table Cell (td)
Returns JSTableObject – JSTableObject created table.
Table Row (tr)
id
sam
Table Cell (td)
Sample
Div
class
sIndent
Code Block
language
javascript
var server = plugins.maintenance.getServer("example_data");
if (server)
{
var table = server.createNewTable("new_table");
if (table) {
table.createNewColumn("new_table_id", JSColumn.INTEGER, 0, false, true);
if (server.synchronizeWithDB(table))
application.output("New table created in the database.");
else
application.output("New table not created in database.");
}
else application.output("New table not created at all.");
}
var server = plugins.maintenance.getServer("example_data");
if (server) {
var result = server.dropTable("new_table");
if (result)
application.output("Table dropped.");
else
application.output("Table not dropped.");
}
var server = plugins.maintenance.getServer("example_data");
if (server) {
var table = server.getTable("employees");
if (table) {
var colNames = table.getColumnNames()
application.output("Table has " + colNames.length + " columns.");
for (var i=0; i<colNames.length; i++)
application.output("Column " + i + ": " + colNames[i]);
}
}
var server = plugins.maintenance.getServer("example_data");
if (!server.isValid()) {
application.output("Server not valid!");
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Table Body (tbody)
id
reloadDataModel
class
node
Table Row (tr)
id
name
Table Cell (td)
reloadDataModel
Table Row (tr)
id
sig
Table Cell (td)
Span
style
float: left; margin-right: 5px;
void
Span
style
float: left; font-weight: bold;
id
iets
reloadDataModel
Span
style
float: left;
id
iets
()
Table Row (tr)
id
des
Table Cell (td)
Reloads the datamodel from the database, if changed externally or via rawSQL plugin.
This call is not needed after a call to synchronizeWithDB().
Table Row (tr)
id
ret
Table Cell (td)
Returns void
Table Row (tr)
id
sam
Table Cell (td)
Sample
Div
class
sIndent
Code Block
language
javascript
var server = plugins.maintenance.getServer("example_data");
var result = plugins.rawSQL.executeSQL("example_data", null, 'CREATE TABLE raw_table (raw_table_id INTEGER)');
if (result) {
application.output("Table created through rawSQL plugin.");
if (server) {
server.reloadDataModel();
// All existing JSTableObject/JSColumn object references are invalid now! Use getTable to get new ones.
var table = server.getTable("raw_table");
if (table) {
var colNames = table.getColumnNames()
application.output("Table has " + colNames.length + " columns.");
for (var i=0; i<colNames.length; i++)
application.output("Column " + i + ": " + colNames[i]);
}
}
}
else {
application.output("Raw table creation failed: " + plugins.rawSQL.getException());
}
Synchronizes a JSTable instance with the database. If columns were added to or removed from the JSTable instance, all these changes will now be persisted to the database.
Table Row (tr)
id
prs
Table Cell (td)
Parameters {JSTableObject} table – A JSTableObject instance that should be synchronized.
var server = plugins.maintenance.getServer("example_data");
if (server)
{
var table = server.createNewTable("new_table");
if (table) {
table.createNewColumn("new_table_id", JSColumn.INTEGER, 0, false, true);
if (server.synchronizeWithDB(table))
application.output("New table created in the database.");
else
application.output("New table not created in database.");
}
else application.output("New table not created at all.");
}