diff --git a/packages/backend/src/db/migrations/20220108141045_add_active_column_to_flows.ts b/packages/backend/src/db/migrations/20220108141045_add_active_column_to_flows.ts new file mode 100644 index 00000000..4b9e323f --- /dev/null +++ b/packages/backend/src/db/migrations/20220108141045_add_active_column_to_flows.ts @@ -0,0 +1,13 @@ +import { Knex } from "knex"; + +export async function up(knex: Knex): Promise { + return knex.schema.table('flows', (table) => { + table.boolean('active').defaultTo(false) + }); +} + +export async function down(knex: Knex): Promise { + return knex.schema.table('flows', (table) => { + table.dropColumn('active'); + }); +} diff --git a/packages/backend/src/graphql/types/flow.ts b/packages/backend/src/graphql/types/flow.ts index 53cb16f9..1cb3557a 100644 --- a/packages/backend/src/graphql/types/flow.ts +++ b/packages/backend/src/graphql/types/flow.ts @@ -1,4 +1,4 @@ -import { GraphQLList, GraphQLObjectType, GraphQLString, GraphQLInt } from 'graphql'; +import { GraphQLList, GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLBoolean } from 'graphql'; import StepType from './step'; const flowType = new GraphQLObjectType({ @@ -6,6 +6,7 @@ const flowType = new GraphQLObjectType({ fields: { id: { type: GraphQLInt }, name: { type: GraphQLString }, + active: { type: GraphQLBoolean }, steps: { type: GraphQLList(StepType), } diff --git a/packages/backend/src/models/flow.ts b/packages/backend/src/models/flow.ts index 04e3f27b..2cf26d79 100644 --- a/packages/backend/src/models/flow.ts +++ b/packages/backend/src/models/flow.ts @@ -4,6 +4,7 @@ import Step from './step' class Flow extends Base { id!: number userId!: number + active: boolean static tableName = 'flows'; @@ -12,7 +13,8 @@ class Flow extends Base { properties: { id: { type: 'integer' }, - userId: { type: 'integer' } + userId: { type: 'integer' }, + active: { type: 'boolean' } } }