-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add database to track installations.
- Loading branch information
Showing
10 changed files
with
747 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ name: Test | |
|
||
on: push | ||
|
||
env: | ||
LOCAL_POSTGRES_PASSWORD: ci-password | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
|
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,7 @@ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
"url": process.env.DATABASE_URL, | ||
"migrations-path": path.resolve("migrations"), | ||
"models-path": path.resolve("bot", "models"), | ||
} |
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,53 @@ | ||
import { DataTypes, Model, Sequelize } from "sequelize"; | ||
|
||
export interface InstallationCreationAttributes { | ||
id: string; | ||
isEnterpriseInstallation: boolean; | ||
installationObject: object; | ||
} | ||
|
||
export interface InstallationAttributes { | ||
id: string; | ||
isEnterpriseInstallation: boolean; | ||
installationObject: object; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
} | ||
|
||
export class Installation extends Model<InstallationAttributes, InstallationCreationAttributes> implements InstallationAttributes { | ||
id: string; | ||
isEnterpriseInstallation: boolean; | ||
installationObject: object; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
} | ||
|
||
export function InstallationFactory(sequelize: Sequelize) { | ||
Installation.init({ | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: DataTypes.STRING, | ||
}, | ||
isEnterpriseInstallation: { | ||
allowNull: false, | ||
type: DataTypes.BOOLEAN, | ||
}, | ||
installationObject: { | ||
allowNull: false, | ||
type: DataTypes.JSON, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: DataTypes.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: DataTypes.DATE, | ||
} | ||
}, { | ||
sequelize, | ||
}); | ||
|
||
return Installation; | ||
}; |
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,31 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.createTable('Installations', { | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: Sequelize.STRING | ||
}, | ||
isEnterpriseInstallation: { | ||
allowNull: false, | ||
type: Sequelize.BOOLEAN | ||
}, | ||
installationObject: { | ||
allowNull: false, | ||
type: Sequelize.JSON | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.dropTable('Installations'); | ||
} | ||
}; |
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.