-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow multiple custom domains (#317)
* add migration to remove unique constraint on user_id in domains table * add migration to add uuid field to domains table * run latest migrations on start, rather than next migration * allow client to show multiple domains * remove domains from redis when they are deleted
- Loading branch information
Showing
6 changed files
with
37 additions
and
11 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
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,26 @@ | ||
import * as Knex from "knex"; | ||
import * as models from "../models"; | ||
|
||
export async function up(knex: Knex): Promise<any> { | ||
await models.createUserTable(knex); | ||
await models.createIPTable(knex); | ||
await models.createDomainTable(knex); | ||
await models.createHostTable(knex); | ||
await models.createLinkTable(knex); | ||
await models.createVisitTable(knex); | ||
|
||
await Promise.all([ | ||
knex.raw(` | ||
ALTER TABLE domains | ||
DROP CONSTRAINT IF EXISTS domains_user_id_unique | ||
`), | ||
knex.raw(` | ||
ALTER TABLE domains | ||
ADD COLUMN IF NOT EXISTS uuid UUID DEFAULT uuid_generate_v4() | ||
`) | ||
]); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<any> { | ||
// do nothing | ||
} |
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