Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
M
matrix-appservice-discord
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
salixor
matrix-appservice-discord
Validations
3524da9a
Valider
3524da9a
rédigé
16 mai 2019
par
Will Hunt
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Add indexes to tables
parent
407581ae
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/db/schema/v10.ts
+54
-0
54 ajouts, 0 suppression
src/db/schema/v10.ts
src/store.ts
+2
-2
2 ajouts, 2 suppressions
src/store.ts
avec
56 ajouts
et
2 suppressions
src/db/schema/v10.ts
0 → 100644
+
54
−
0
Voir le fichier @
3524da9a
/*
Copyright 2018 matrix-appservice-discord
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import
{
IDbSchema
}
from
"
./dbschema
"
;
import
{
DiscordStore
}
from
"
../../store
"
;
import
{
Log
}
from
"
../../log
"
;
const
log
=
new
Log
(
"
SchemaV10
"
);
export
class
Schema
implements
IDbSchema
{
public
description
=
"
create indexes on tables
"
;
private
readonly
INDEXES
=
{
idx_discord_msg_store_msgid
:
[
"
discord_msg_store
"
,
"
msg_id
"
],
idx_emoji_id
:
[
"
emoji
"
,
"
emoji_id
"
],
idx_emoji_mxc_url
:
[
"
emoji
"
,
"
mxc_url
"
],
idx_event_store_discord_id
:
[
"
event_store
"
,
"
discord_id
"
],
idx_event_store_matrix_id
:
[
"
event_store
"
,
"
matrix_id
"
],
idx_remote_room_data_room_id
:
[
"
remote_room_data
"
,
"
room_id
"
],
idx_room_entries_id
:
[
"
room_entries
"
,
"
id
"
],
idx_room_entries_matrix_id
:
[
"
room_entries
"
,
"
matrix_id
"
],
idx_room_entries_remote_id
:
[
"
room_entries
"
,
"
remote_id
"
],
};
public
async
run
(
store
:
DiscordStore
):
Promise
<
void
>
{
try
{
await
Promise
.
all
(
Object
.
keys
(
this
.
INDEXES
).
map
(
async
(
indexId
:
string
)
=>
{
const
ids
=
this
.
INDEXES
[
indexId
];
return
store
.
db
.
Exec
(
`CREATE INDEX
${
indexId
}
ON
${
ids
[
0
]}
(
${
ids
[
1
]}
)`
);
}));
}
catch
(
ex
)
{
log
.
error
(
"
Failed to apply indexes:
"
,
ex
);
}
}
public
async
rollBack
(
store
:
DiscordStore
):
Promise
<
void
>
{
await
Promise
.
all
(
Object
.
keys
(
this
.
INDEXES
).
map
(
async
(
indexId
:
string
)
=>
{
return
store
.
db
.
Exec
(
`DROP INDEX
${
indexId
}
`
);
}));
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
src/store.ts
+
2
−
2
Voir le fichier @
3524da9a
...
@@ -18,8 +18,6 @@ import * as fs from "fs";
...
@@ -18,8 +18,6 @@ import * as fs from "fs";
import
{
IDbSchema
}
from
"
./db/schema/dbschema
"
;
import
{
IDbSchema
}
from
"
./db/schema/dbschema
"
;
import
{
IDbData
}
from
"
./db/dbdatainterface
"
;
import
{
IDbData
}
from
"
./db/dbdatainterface
"
;
import
{
SQLite3
}
from
"
./db/sqlite3
"
;
import
{
SQLite3
}
from
"
./db/sqlite3
"
;
export
const
CURRENT_SCHEMA
=
9
;
import
{
Log
}
from
"
./log
"
;
import
{
Log
}
from
"
./log
"
;
import
{
DiscordBridgeConfigDatabase
}
from
"
./config
"
;
import
{
DiscordBridgeConfigDatabase
}
from
"
./config
"
;
import
{
Postgres
}
from
"
./db/postgres
"
;
import
{
Postgres
}
from
"
./db/postgres
"
;
...
@@ -29,7 +27,9 @@ import { DbUserStore } from "./db/userstore";
...
@@ -29,7 +27,9 @@ import { DbUserStore } from "./db/userstore";
import
{
import
{
RoomStore
,
UserStore
,
RoomStore
,
UserStore
,
}
from
"
matrix-appservice-bridge
"
;
}
from
"
matrix-appservice-bridge
"
;
const
log
=
new
Log
(
"
DiscordStore
"
);
const
log
=
new
Log
(
"
DiscordStore
"
);
export
const
CURRENT_SCHEMA
=
10
;
/**
/**
* Stores data for specific users and data not specific to rooms.
* Stores data for specific users and data not specific to rooms.
*/
*/
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter