In both the code files you have
This is creating distinctly different db variables.
In the main file add
db to your
ns table and get it from there in the ChatCommands.lua file.
Or use
MapNotesMiniButton.db in the ChatCommands.lua file, whichever
db is the right one and is available in both files either via a global or the ns table.
A quick look further and in the main file you're creating
and then throwing it away in PLAYER_LOGIN and replacing it with
Code:
db = self.db.profile
Where self is
Addon. Which means Addon should be added to your
ns table and in ChatCommands use:
Code:
local db = NS.Addon.db
or give the frame a name and use that.