I use yaml, but I think it is almost the same as xml or json. I found that you can use addForeignKeyConstraint, but I want to add a constraint when creating the table without modifying the existing table. How should I do it? Can I do something like this?
- changeSet:
id: create_questions
author: Author
changes:
- createTable:
tableName: questions
columns:
- column:
name: id
type: int
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: user_id
type: int
constraints:
foreignKey:
referencedColumnNames: id
referencedTableName: users
nullable: false
- column:
name: question
type: varchar(255)
constraints:
nullable: false
source
share