Skip to content

Commit 6f52b6d

Browse files
committed
removed add folder
1 parent 87e3595 commit 6f52b6d

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Our.Umbraco.AuthU.Models;
2+
using Umbraco.Core.Migrations;
3+
4+
namespace Our.Umbraco.AuthU.Data.Migrations.UmbracoDbOAuthClientStore
5+
{
6+
/// <summary>
7+
/// Simple migration to create the OAuthClient Table
8+
/// </summary>
9+
internal class CreateAuthClientStoreTable : MigrationBase
10+
{
11+
public CreateAuthClientStoreTable(IMigrationContext context)
12+
: base(context)
13+
{ }
14+
15+
public override void Migrate()
16+
{
17+
if (!TableExists("OAuthClient"))
18+
Create.Table<OAuthClient>().Do();
19+
}
20+
}
21+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Our.Umbraco.AuthU.Models;
2+
using Umbraco.Core.Migrations;
3+
4+
namespace Our.Umbraco.AuthU.Data.Migrations.UmbracoDbOAuthClientStore
5+
{
6+
/// <summary>
7+
/// Simple migration to add a demo client to the OAuthClient Table
8+
/// </summary>
9+
internal class CreateDemoClient : MigrationBase
10+
{
11+
public CreateDemoClient(IMigrationContext context) : base(context)
12+
{ }
13+
14+
public override void Migrate()
15+
{
16+
var existing = Database.SingleOrDefault<OAuthClient>($"SELECT 1 FROM [OAuthClient] WHERE [ClientId] = @0", "DemoClient");
17+
if (existing == null)
18+
{
19+
Database.Save(new OAuthClient
20+
{
21+
ClientId = "DemoClient",
22+
Name = "Demo Client",
23+
Secret = "demo",
24+
SecurityLevel = SecurityLevel.Insecure,
25+
RefreshTokenLifeTime = 14400,
26+
AllowedOrigin = "*"
27+
});
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)