Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom constraints #484

Open
iloudaros opened this issue Dec 11, 2023 · 1 comment
Open

Add support for custom constraints #484

iloudaros opened this issue Dec 11, 2023 · 1 comment

Comments

@iloudaros
Copy link

for example, how can I use dbml to give this description :

CREATE TABLE `MyTable` (
  `id` INT PRIMARY KEY AUTO_INCREMENT,
  `foreignKey1` INT,
  `foreignKey2` INT,
  CONSTRAINT `check_foreign_key` CHECK (`foreignKey1` IN (SELECT `id` FROM `OtherTable1`) OR `foreignKey2` IN (SELECT `id` FROM `OtherTable2`)))
);
@NQPhuc
Copy link
Contributor

NQPhuc commented Dec 12, 2023

Hi,

For the columns and table, you can define dbml like this (However, there's currently no equivalent dbml syntax for CHECK CONTRAINTS):

Table "MyTable" {
  "id" INT [pk, increment]
  "foreignKey1" INT
  "foreignKey2" INT
}

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

No branches or pull requests

2 participants