mirror of
https://github.com/absmach/supermq.git
synced 2026-06-23 06:40:19 +00:00
dcd5ff914d
* initial implementation Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * initial implementation Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * add remove report from nats handler Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * add license header Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * fix failing linter Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * remove unused code Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update docker compose Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * address comments Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * fix failing linter Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * move runinfo to pkg Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update report handler Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update reports handler Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update handler in reports Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update repo method from time to due Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * fix validation methods Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * address comments Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update reports port to 9017 Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update nginx to support reports Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * fix reports location in nginx Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> * update env variable Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> --------- Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package postgres
|
|
|
|
import (
|
|
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
|
|
migrate "github.com/rubenv/sql-migrate"
|
|
)
|
|
|
|
func Migration() *migrate.MemoryMigrationSource {
|
|
return &migrate.MemoryMigrationSource{
|
|
Migrations: []*migrate.Migration{
|
|
{
|
|
Id: "rules_01",
|
|
// VARCHAR(36) for colums with IDs as UUIDS have a maximum of 36 characters
|
|
// STATUS 0 to imply enabled and 1 to imply disabled
|
|
Up: []string{
|
|
`CREATE TABLE IF NOT EXISTS rules (
|
|
id VARCHAR(36) PRIMARY KEY,
|
|
name VARCHAR(1024),
|
|
domain_id VARCHAR(36) NOT NULL,
|
|
metadata JSONB,
|
|
created_by VARCHAR(254),
|
|
created_at TIMESTAMP,
|
|
updated_at TIMESTAMP,
|
|
updated_by VARCHAR(254),
|
|
input_channel VARCHAR(36),
|
|
input_topic TEXT,
|
|
output_channel VARCHAR(36),
|
|
output_topic TEXT,
|
|
status SMALLINT NOT NULL DEFAULT 0 CHECK (status >= 0),
|
|
logic_type SMALLINT NOT NULL DEFAULT 0 CHECK (logic_type >= 0),
|
|
logic_output SMALLINT[] NOT NULL DEFAULT '{}',
|
|
logic_value BYTEA,
|
|
time TIMESTAMP,
|
|
recurring SMALLINT,
|
|
recurring_period SMALLINT,
|
|
start_datetime TIMESTAMP
|
|
)`,
|
|
},
|
|
Down: []string{
|
|
`DROP TABLE IF EXISTS rules`,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|