CREATE TABLE macmiguel (
  idmacmiguel VARCHAR(17) NOT NULL,
  nome VARCHAR(35) NULL,
  ativo BOOL NULL DEFAULT 0,
  limite INTEGER UNSIGNED NULL DEFAULT 0,
  contador INTEGER UNSIGNED NULL DEFAULT 0,
  PRIMARY KEY(idmacmiguel)
);

CREATE TABLE leituramiguel (
  idleituramiguel INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  macmiguel_idmacmiguel VARCHAR(17) NOT NULL,
  nome VARCHAR(50) NULL,
  datahora DATETIME NULL,
  valor REAL NULL,
  PRIMARY KEY(idleituramiguel),
  INDEX leituramiguel_FKIndex1(macmiguel_idmacmiguel),
  FOREIGN KEY(macmiguel_idmacmiguel)
    REFERENCES macmiguel(idmacmiguel)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION
);


