Make column not nullable

This commit is contained in:
Fang-Pen Lin
2025-11-07 09:18:03 -08:00
parent 2d8126c011
commit 806e11a5b2
2 changed files with 5 additions and 2 deletions
@@ -35,7 +35,10 @@ export async function up(knex: Knex): Promise<void> {
if (await knex.schema.hasColumn(TableName.PkiCertificateProfile, "enrollmentType")) {
// Notice: it's okay to use `.checkIn(...).alter();` here because the constraint name is all lowercase.
await knex.schema.alterTable(TableName.PkiCertificateProfile, (t) => {
t.string("enrollmentType").checkIn(["api", "est", "acme"], NEW_ENROLLMENT_TYPE_CHECK_CONSTRAINT).alter();
t.string("enrollmentType")
.notNullable()
.checkIn(["api", "est", "acme"], NEW_ENROLLMENT_TYPE_CHECK_CONSTRAINT)
.alter();
});
}