1

I am currently working on a small web-app stored in a monorepo and using PSQL as database (hosted on GCP). It's my first time working for a web app and I have to create a lot of tables manually such as using this script to create the positions tables:

CREATE TABLE PUBLIC.positions
  (
     position_id  INTEGER NOT NULL GENERATED always AS IDENTITY,
     x_pos        INTEGER NULL,
     y_pos        INTEGER NULL,
     is_empty     BOOLEAN NULL,
     crop_type_id INTEGER NULL
  );

ALTER TABLE PUBLIC.positions
  ADD CONSTRAINT positions_pkey PRIMARY KEY (position_id);

My question is the following, should I save that table creation SQL code somewhere? If so, are there any good practices for naming and structuring?

2

0

Browse other questions tagged or ask your own question.