CREATE TABLE app (
    id TEXT PRIMARY KEY NOT NULL,
    name TEXT NOT NULL,
    description TEXT,
    address TEXT NOT NULL,
    ssh_address TEXT
);

-- Create blogs table
CREATE TABLE blog (
    id TEXT PRIMARY KEY NOT NULL,
    title TEXT NOT NULL,
    content TEXT NOT NULL,
    reference TEXT,
    FOREIGN KEY (reference) REFERENCES app(id)
);

-- Create identites table
CREATE TABLE identities (
    id TEXT PRIMARY KEY NOT NULL,
    common_name TEXT NOT NULL,
    username TEXT NOT NULL,
    public_key TEXT NOT NULL,
    private_key TEXT NOT NULL
);

-- Create index for foreign key relationship
CREATE INDEX idx_blogs_reference ON blog(reference);
