Push

The push is the process of updating the sources (Databases) with the schema defined in the configuration file. The push process is done by the command lambdaorm push.

CLI

When executing the push command, ddl code will be executed according to the definition in the lambdaorm schema file.

  • Tables, indexes and keys will be created
  • The executed code is added to a file in the data folder.
  • The [source-name]-model.json file will be created or updated which maintains the source state since the last synchronization.
lambdaorm push

Files generated:

├── orm_state
│   ├── default-ddl-20231122T154351640Z-push-test.sql
│   └── default-model.json

Content of the generated file default-ddl-20231122T154351640Z-push-test.sql:

CREATE TABLE Countries (name VARCHAR(80) NOT NULL ,iso3 VARCHAR(3) NOT NULL ,CONSTRAINT Countries_PK PRIMARY KEY (iso3));
ALTER TABLE Countries ADD CONSTRAINT Countries_UK UNIQUE (name);
CREATE TABLE States (id INTEGER NOT NULL ,name VARCHAR(80) NOT NULL ,countryCode VARCHAR(3) NOT NULL ,CONSTRAINT States_PK PRIMARY KEY (id));
ALTER TABLE States ADD CONSTRAINT States_UK UNIQUE (countryCode,name);
ALTER TABLE States ADD CONSTRAINT States_country_FK FOREIGN KEY (countryCode) REFERENCES Countries (iso3);

View labs: