CREATE TABLE IF NOT EXISTS "users" (
    "email" TEXT PRIMARY KEY,
    "created_at" TEXT NOT NULL DEFAULT (datetime()),
    "updated_at" TEXT NOT NULL DEFAULT (datetime()),
    "password_hash" TEXT NOT NULL,
    "name" TEXT NOT NULL,
    "login_token" TEXT NULL
) STRICT;

CREATE TABLE IF NOT EXISTS "maps" (
    "id" TEXT PRIMARY KEY,
    "created_at" TEXT NOT NULL DEFAULT (datetime()),
    "updated_at" TEXT NOT NULL DEFAULT (datetime()),
    "name" TEXT NOT NULL
) STRICT;

CREATE TABLE IF NOT EXISTS "markers" (
    "id" TEXT PRIMARY KEY,
    "created_at" TEXT NOT NULL DEFAULT (datetime()),
    "updated_at" TEXT NOT NULL DEFAULT (datetime()),
    "map_id" TEXT NOT NULL REFERENCES maps(id),
    "lat" REAL NOT NULL,
    "lng" REAL NOT NULL,
    "color" TEXT NOT NULL,
    "name" TEXT NULL,
    "description" TEXT NULL,
    "icon" TEXT NULL,
    "radius" INTEGER NULL
) STRICT;
