user9724193
user9724193

Reputation:

Store Default date as Today's date column in Appmaker

Is there any configuration option available in Appmaker to Store Today's date as Default in a column record in Appmaker data source?

The current configuration directly provided an option to select date only, no option to write a script which can return me Today's date. Current option for choosing date

Upvotes: 3

Views: 901

Answers (1)

Pavel Shkleinik
Pavel Shkleinik

Reputation: 6347

Unfortunately, App Maker doesn't provide such setting at this time, but there are at least two ways how you can do it:

  1. If you you are using Custom Cloud SQL instance you can make your table look like this:
CREATE TABLE foo (
    `creation_time`     DATETIME DEFAULT CURRENT_TIMESTAMP,
    `modification_time` DATETIME ON UPDATE CURRENT_TIMESTAMP
)
  1. In case you don't have direct access to the database you can add the following code in onBeforeCreate model event
record.CreatedOn = new Date();

Upvotes: 3

Related Questions