diff --git a/migrations/20240702164031-add-client-tax.js b/migrations/20240702164031-add-client-tax.js new file mode 100644 index 0000000..783ff2c --- /dev/null +++ b/migrations/20240702164031-add-client-tax.js @@ -0,0 +1,49 @@ +'use strict'; + +var dbm; +var type; +var seed; +var fs = require('fs'); +var path = require('path'); +var Promise; + +/** + * We receive the dbmigrate dependency from dbmigrate initially. + * This enables us to not have to rely on NODE_PATH. + */ +exports.setup = function(options, seedLink) { + dbm = options.dbmigrate; + type = dbm.dataType; + seed = seedLink; + Promise = options.Promise; +}; + +exports.up = function(db) { + var filePath = path.join(__dirname, 'sqls', '20240702164031-add-client-tax-up.sql'); + return new Promise( function( resolve, reject ) { + fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ + if (err) return reject(err); + resolve(data); + }); + }) + .then(function(data) { + return db.runSql(data); + }); +}; + +exports.down = function(db) { + var filePath = path.join(__dirname, 'sqls', '20240702164031-add-client-tax-down.sql'); + return new Promise( function( resolve, reject ) { + fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ + if (err) return reject(err); + resolve(data); + }); + }) + .then(function(data) { + return db.runSql(data); + }); +}; + +exports._meta = { + "version": 1 +}; diff --git a/migrations/sqls/20240702164031-add-client-tax-down.sql b/migrations/sqls/20240702164031-add-client-tax-down.sql new file mode 100644 index 0000000..f355feb --- /dev/null +++ b/migrations/sqls/20240702164031-add-client-tax-down.sql @@ -0,0 +1 @@ +alter table billing.clients drop column taxable; \ No newline at end of file diff --git a/migrations/sqls/20240702164031-add-client-tax-up.sql b/migrations/sqls/20240702164031-add-client-tax-up.sql new file mode 100644 index 0000000..2c4e325 --- /dev/null +++ b/migrations/sqls/20240702164031-add-client-tax-up.sql @@ -0,0 +1 @@ +alter table billing.clients add column taxable boolean not null default false; \ No newline at end of file diff --git a/schema-dump.sql b/schema-dump.sql index e035420..1f2e929 100644 --- a/schema-dump.sql +++ b/schema-dump.sql @@ -2961,7 +2961,8 @@ CREATE TABLE billing.clients ( id uuid DEFAULT public.uuid_generate_v1mc() NOT NULL, name text NOT NULL, access_token text DEFAULT md5((random())::text), - created_at timestamp without time zone DEFAULT now() NOT NULL + created_at timestamp without time zone DEFAULT now() NOT NULL, + taxable boolean DEFAULT false NOT NULL );