generated from 8iq/nodejs-hackathon-boilerplate-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adc95e8
commit 16adb65
Showing
7 changed files
with
187 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
apps/condo/migrations/20240205113249-0364_marketpricescope_type_and_more.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// auto generated by kmigrator | ||
// KMIGRATOR:0364_marketpricescope_type_and_more:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDQuMi40IG9uIDIwMjQtMDItMDUgMDY6MzMKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAzNjNfYXV0b18yMDI0MDEyOV8wNTI4JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdtYXJrZXRwcmljZXNjb3BlJywKICAgICAgICAgICAgbmFtZT0ndHlwZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5DaGFyRmllbGQoY2hvaWNlcz1bKCd1bmtub3duJywgJ3Vua25vd24nKSwgKCdvcmdhbml6YXRpb24nLCAnb3JnYW5pemF0aW9uJyksICgncHJvcGVydHknLCAncHJvcGVydHknKV0sIGRlZmF1bHQ9J3Vua25vd24nLCBtYXhfbGVuZ3RoPTUwKSwKICAgICAgICAgICAgcHJlc2VydmVfZGVmYXVsdD1GYWxzZSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J21hcmtldHByaWNlc2NvcGVoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0ndHlwZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo= | ||
|
||
exports.up = async (knex) => { | ||
await knex.raw(` | ||
BEGIN; | ||
-- | ||
-- Add field type to marketpricescope | ||
-- | ||
ALTER TABLE "MarketPriceScope" ADD COLUMN "type" varchar(50) DEFAULT 'unknown' NOT NULL; | ||
ALTER TABLE "MarketPriceScope" ALTER COLUMN "type" DROP DEFAULT; | ||
-- | ||
-- Add field type to marketpricescopehistoryrecord | ||
-- | ||
ALTER TABLE "MarketPriceScopeHistoryRecord" ADD COLUMN "type" text NULL; | ||
--- MANUAL | ||
--- Set type for existing scopes | ||
SET statement_timeout = '1500s'; | ||
UPDATE "MarketPriceScope" SET "type"='organization' WHERE property IS NULL; | ||
UPDATE "MarketPriceScope" SET "type"='property' WHERE property IS NOT NULL; | ||
SET statement_timeout = '10s'; | ||
--- LAUNAM | ||
COMMIT; | ||
`) | ||
} | ||
|
||
exports.down = async (knex) => { | ||
await knex.raw(` | ||
BEGIN; | ||
-- | ||
-- Add field type to marketpricescopehistoryrecord | ||
-- | ||
ALTER TABLE "MarketPriceScopeHistoryRecord" DROP COLUMN "type" CASCADE; | ||
-- | ||
-- Add field type to marketpricescope | ||
-- | ||
ALTER TABLE "MarketPriceScope" DROP COLUMN "type" CASCADE; | ||
COMMIT; | ||
`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.