Ff00ff/mammoth

Way to associate additional metadata with schema?

Opened this issue · 0 comments

There are a few cases where we want to add annotations to our DB schema for another tool to read. For example, we want to select a subset of columns to export to our BI/analytics database:

We could define something like this:

const usersTableBiExports = {
    id: true,
    createdTime: true,
    name: true,
    ...
};

I was wondering if there's a way to specify this as part of the Mammoth schema itself, just so it's all in one place, e.g.:

const users = defineTable({
    id: text().notNull().primaryKey().metadata({bi: true}),
    createdTime: timestamptz().notNull().metadata({bi: true}),
    name: text().notNull().metadata({bi: true}),
    emailAddress: citext().notNull().unique().metadata({bi: true}),
    passwordHash: bytea().notNull().metadata({bi: false}),
});

Thoughts?