-- noinspection SqlNoDataSourceInspectionForFile

-- Schema: nsalectrl
-- Brief: NSaleCtrl component controller
-- Created by: ldlima
-- Table schema_version: must be defined for database update through the NSaleCtrlPersistence component

CREATE TABLE schema_version AS
SELECT "$Author: ldlima $" AS Author,
       "$Date: 2022-10-17 10:00:00 -0300$" AS LastModifiedAt,
       "$Revision: d03e68da85a032fbe9b9713e5f9bd2657e9986bc$" AS Revision;

-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CREATE TABLE Event (
  Id              INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  Type            VARCHAR(25) NOT NULL,
  OrderId         INTEGER NOT NULL,
  Content         VARCHAR(255) NOT NULL,
  Timestamp       DATE NOT NULL
);

CREATE UNIQUE INDEX 'idx_Event_Id' ON 'Event' ('Id');


CREATE TABLE EventStatus (
  EventId         INTEGER NOT NULL,
  Component       VARCHAR(25),
  RetryNumber     INTEGER,
  AckTimestamp    DATE
);
