Skip to content

MariaDB .env helper's TABLE_SCHEMA always empty #331

@Nealium

Description

@Nealium

This is most likely user error. I'm using dotenv.vim to load my database into the plugin using the string mysql://user:pass@localhost:3306/mydb. I am using MariaDB, but usually it's a 1-1 with mysql

The default helper functions Primary Keys and Foreign Keys seem to go off of {schema} which is always empty for me. I've overridden the default helpers to use {dbname} instead, as per guidance from #108

like this..

let g:db_ui_table_helpers = {
\   'mysql': {
\        "Primary Keys": "SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_SCHEMA = '{dbname}' AND TABLE_NAME = '{table}' AND CONSTRAINT_TYPE = 'PRIMARY KEY'",
\        "Foreign Keys": "SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_SCHEMA = '{dbname}' AND TABLE_NAME = '{table}' AND CONSTRAINT_TYPE = 'FOREIGN KEY'"
\   }

This works, but it just bugs the crap out of me that it's "wrong" and this "schema" isn't working for me. Any advice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions