Skip to content

fix: enhance project initialization and menu transformation capabilities#631

Open
NoOne7135 wants to merge 8 commits into
mainfrom
feature/AdminForth/1647/do-not-create-a-prism-if-the-d
Open

fix: enhance project initialization and menu transformation capabilities#631
NoOne7135 wants to merge 8 commits into
mainfrom
feature/AdminForth/1647/do-not-create-a-prism-if-the-d

Conversation

@NoOne7135

Copy link
Copy Markdown
Collaborator

No description provided.

This comment was marked as duplicate.

This comment was marked as outdated.

This comment was marked as outdated.

ORDER BY id;
\`\`\`

ClickHouse does not enforce UNIQUE constraints like PostgreSQL, MySQL, or SQLite. AdminForth authentication expects \`email\` values in \`adminuser\` to be unique, so enforce this in your ingestion/application logic and remove duplicate email rows to avoid ambiguous logins.`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NoOne7135 actually I think we don't need it here, also I think we can safely remove all unique constraints form other DBs snippets. This should be specified in AdminForth resource config already - and it takes care about all of these on own soft layer. Hard unique constraints in DB are often more pain because if u have it here, but af layer will set unique to false, users will get direct db errors, instead of clear nice message (+other reasons) - so lets leave this decision for user, if he wants to get this pain - he can add it by himself.
Uniques - often create implicit index (but it is easier to create non unique index = same log2 access performance). Also UNIQUE is good of course for integrity, but adminforth will do it anyway by himself by additional checks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - please explain to user that all these snippets are just for example, we recommend him to use his favorite migration tool first. This is just example

}

if (provider === 'mongodb') {
return 'Create an `adminuser` collection with `id`, `email`, `password_hash`, `role`, and `created_at` fields. Keep `email` unique in your own schema/index setup.';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In mongo user has to do nothing ;)
It is not possible to create collection IMO. Mongo concept is just write to any collection any fields and mongo will create everything. So no additional steps should be needed. At least by mongo design

});
}

async isDatabaseEmpty(): Promise<boolean> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think prisma for mongo has no sense at all. Never. It works with mongo - yes. But not for migrations - this is for typesafe prisma client which we dont use anyway!
So nothing decide here - simply lets never include prisma for mongo. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants