OS2iot / OS2iot-backend

This repository contains the backend to the project OS2iot.
Mozilla Public License 2.0
10 stars 7 forks source link

Initial migration #134

Closed AramAlsabti closed 2 years ago

AramAlsabti commented 2 years ago

This adds the first migration which reflects the database in its current state. This enables future deployments to properly initialize and configure a newly created database.

Note that this is a breaking change for existing setups as the database is already configured. The following steps must be taken to migrate:

  1. Create a new table "migrations". If it already exists, and has rows, it must be backed up and cleared as the migrations must appear in the correct order. The query for creating the table is: CREATE TABLE "migrations" ("id" SERIAL NOT NULL, "timestamp" int8, name varchar(255), PRIMARY KEY ("id")).
  2. Insert the correct values in the rows timestamp and name, using the filename of the first migration. It should be a. timestamp: 1641894827503 b. name: Initial1641894827503
  3. Run the migrations (or start the backend). It should output "No migrations are pending"

This change, and the steps above, should be clearly described in the next release.