feat: init email template schema for all providers

This commit is contained in:
Lakhan Samani
2022-07-15 10:23:45 +05:30
parent 14c74f6566
commit 283e570ebb
4 changed files with 35 additions and 1 deletions

View File

@@ -134,6 +134,20 @@ func NewProvider() (*provider, error) {
Sparse: true,
})
emailTemplateCollectionExists, err := arangodb.CollectionExists(ctx, models.Collections.EmailTemplate)
if !emailTemplateCollectionExists {
_, err = arangodb.CreateCollection(ctx, models.Collections.EmailTemplate, nil)
if err != nil {
return nil, err
}
}
emailTemplateCollection, _ := arangodb.Collection(nil, models.Collections.EmailTemplate)
emailTemplateCollection.EnsureHashIndex(ctx, []string{"event_name"}, &arangoDriver.EnsureHashIndexOptions{
Unique: true,
Sparse: true,
})
return &provider{
db: arangodb,
}, err