Fixed error when setting Oracle column to not null (#8111)

* Fixed error when setting Oracle column to not null

* Normalized migrations for all vendors

* Downgraded knex version

* Updated knex again

* Update 20210907A-webhooks-collections-not-null.ts

* Update 20210920A-webhooks-url-not-null.ts

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
Aiden Foxx
2021-09-22 22:02:24 +02:00
committed by GitHub
parent ad3fc9579a
commit c6eda9fe69
5 changed files with 44 additions and 3 deletions

View File

@@ -117,7 +117,7 @@
"json2csv": "^5.0.3",
"jsonwebtoken": "^8.5.1",
"keyv": "^4.0.3",
"knex": "^0.95.6",
"knex": "^0.95.11",
"knex-schema-inspector": "1.6.1",
"liquidjs": "^9.25.0",
"lodash": "^4.17.21",

View File

@@ -28,6 +28,6 @@ export async function down(knex: Knex): Promise<void> {
}
await knex.schema.alterTable('directus_webhooks', (table) => {
table.string('url').alter();
table.string('url').notNullable().alter();
});
}

View File

@@ -28,6 +28,6 @@ export async function down(knex: Knex): Promise<void> {
}
await knex.schema.alterTable('directus_webhooks', (table) => {
table.string('collections').alter();
table.string('collections').notNullable().alter();
});
}

View File

@@ -1,12 +1,26 @@
import { Knex } from 'knex';
// @ts-ignore
import Client_Oracledb from 'knex/lib/dialects/oracledb';
export async function up(knex: Knex): Promise<void> {
if (knex.client instanceof Client_Oracledb) {
/* Oracle is already not nullable due to an oversight in
"20210312A-webhooks-collections-text.ts" */
return;
}
await knex.schema.alterTable('directus_webhooks', (table) => {
table.text('collections').notNullable().alter();
});
}
export async function down(knex: Knex): Promise<void> {
if (knex.client instanceof Client_Oracledb) {
/* Oracle is already not nullable due to an oversight in
"20210312A-webhooks-collections-text.ts" */
return;
}
await knex.schema.alterTable('directus_webhooks', (table) => {
table.text('collections').alter();
});

View File

@@ -0,0 +1,27 @@
import { Knex } from 'knex';
// @ts-ignore
import Client_Oracledb from 'knex/lib/dialects/oracledb';
export async function up(knex: Knex): Promise<void> {
if (knex.client instanceof Client_Oracledb) {
/* Oracle is already not nullable due to an oversight in
"20201105B-change-webhook-url-type.ts" */
return;
}
await knex.schema.alterTable('directus_webhooks', (table) => {
table.text('url').notNullable().alter();
});
}
export async function down(knex: Knex): Promise<void> {
if (knex.client instanceof Client_Oracledb) {
/* Oracle is already not nullable due to an oversight in
"20201105B-change-webhook-url-type.ts" */
return;
}
await knex.schema.alterTable('directus_webhooks', (table) => {
table.text('url').alter();
});
}