Creating Custom table in Metabase application database

Hello everyone.
Hope you are doing well.

For client 's needs, I have to create new custom table in Metabase application database.
Currently, we use MySQL.
Of course, I can create this table manually in MySQL.

But I want to know rightful ways to create new table/model in backend.

Could you tell me ...

  • Where should I define table schema ?
  • Are there any way to make MB to migrate my custom table (only structure, don't think about data) into application database automatically ? (In case that I install my customized MB onto new hosting server)

Looking forward to your kind consideration.
Best regards.

Hi @danchen327
Can you explain exactly why you are trying to implement?
You would create the table in the migration script https://github.com/metabase/metabase/blob/master/resources/migrations/000_migrations.yaml or elsewhere, so it's automatically managed by Liquibase, and then you would reference it like this in your model code:
(models/defmodel MyAwesomeTable :custom_awesometable)

Thanks for your kind help.

Client want custom collection ordering in sidebar.
Of course, he knows MB does 'A~Z' order in default. Bookmarks either.

But he wish something to change collections' order freely in drag and drop mode.

To save customized order info,
I am trying to make new table or add new field in existing table.

  • Are there any pre built features in MB for collection ordering ?

@danchen327 Sounds like you just want to add a column to collection table, and then change the calls, so they make use of the ordering. Have a look at report_card.collection_position (or report_dashboard.collection_position) which handles positioning of pinned items in a collection.

Thank you very much.