mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
599fb80112
The frontend is still broken and doesn't use these endpoints at all. A migration tool still needs to be written to pull in existing widget configurations.
42 lines
2.0 KiB
TypeScript
42 lines
2.0 KiB
TypeScript
import { QueryInterface } from "sequelize";
|
|
import { DataType } from "sequelize-typescript";
|
|
import * as Promise from "bluebird";
|
|
|
|
export default {
|
|
up: (queryInterface: QueryInterface) => {
|
|
return Promise.resolve()
|
|
.then(() => queryInterface.createTable("dimension_users", {
|
|
"userId": {type: DataType.STRING, primaryKey: true, allowNull: false},
|
|
}))
|
|
.then(() => queryInterface.createTable("dimension_upstreams", {
|
|
"id": {type: DataType.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false},
|
|
"name": {type: DataType.STRING, allowNull: false},
|
|
"type": {type: DataType.STRING, allowNull: false},
|
|
"scalarUrl": {type: DataType.STRING, allowNull: false},
|
|
"apiUrl": {type: DataType.STRING, allowNull: false},
|
|
}))
|
|
.then(() => queryInterface.createTable("dimension_scalar_tokens", {
|
|
"id": {type: DataType.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false},
|
|
"userId": {
|
|
type: DataType.STRING,
|
|
allowNull: false,
|
|
references: {model: "dimension_users", key: "userId"},
|
|
onUpdate: "cascade", onDelete: "cascade",
|
|
},
|
|
"scalarToken": {type: DataType.STRING, allowNull: false},
|
|
"isDimensionToken": {type: DataType.BOOLEAN, allowNull: false},
|
|
"upstreamId": {
|
|
type: DataType.INTEGER,
|
|
allowNull: true,
|
|
references: {model: "dimension_upstreams", key: "id"},
|
|
onUpdate: "cascade", onDelete: "cascade",
|
|
},
|
|
}));
|
|
},
|
|
down: (queryInterface: QueryInterface) => {
|
|
return Promise.resolve()
|
|
.then(() => queryInterface.dropTable("dimension_users"))
|
|
.then(() => queryInterface.dropTable("dimension_upstreams"))
|
|
.then(() => queryInterface.dropTable("dimension_scalar_tokens"));
|
|
}
|
|
} |