Commit 9a375109 authored by Michael Herndon's avatar Michael Herndon

PROTO: migration history, split RDBMS functionality, add coredns to setup

parent 1b8091a1
......@@ -17,8 +17,6 @@ namespace NerdyMishka.Reflection
private IndexedReadOnlyCollection<IInterface> interfaces;
private bool propertiesFetched = false;
public ReflectionType(TypeInfo info, IReflectionFactory factory)
: this(info.AsType(), factory)
{
......
......@@ -14,19 +14,25 @@ namespace NerdyMishka.Data.Migrations
string[] Tags { get; }
}
public interface IMigrationHistoryService
public interface IRdbmsMigrationHistoryService : IMigrationHistoryService
{
ISqlExecutor SqlExecutor { get; set; }
string SchemaName { get; }
string TableName { get; }
}
ISqlExecutor SqlExecutor { get; set; }
public interface IMigrationHistoryService
{
long GetCurrentVersion(string category = null);
void CreateTable();
bool HasStore();
void CreateStore();
void DropTable();
void DropStore();
void AddVersion(IMigrationVersion version);
......
......@@ -90,12 +90,28 @@ namespace NerdyMishka.Data.Migrations
if(this.Connection.State == DataConnectionState.Closed)
this.Connection.Open();
IRdbmsMigrationHistoryService rdbms = null;
if(this.History is IRdbmsMigrationHistoryService)
{
rdbms = (IRdbmsMigrationHistoryService)this.History;
rdbms.SqlExecutor = this.Connection.BeginTransaction();
if(!rdbms.HasStore()) {
rdbms.CreateStore();
}
// commit;
rdbms.SqlExecutor.Dispose();
rdbms.SqlExecutor = null;
}
if(this.SqlExecutor == null)
{
this.Connection.Open();
this.SqlExecutor = this.Connection.BeginTransaction();
}
if(rdbms != null)
rdbms.SqlExecutor = this.SqlExecutor;
}
public void StepToVersion(int steps, string category = null)
......@@ -254,7 +270,7 @@ namespace NerdyMishka.Data.Migrations
list = (from o in this.Migrations
where o.Category == category
&& o.Version > -1
&& o.Version > currentVersion
orderby o.Version ascending
select o).ToList();
}
......@@ -262,7 +278,7 @@ namespace NerdyMishka.Data.Migrations
{
list = (from o in this.Migrations
where o.Category == category
&& o.Version > -1
&& o.Version < currentVersion
orderby o.Version descending
select o).ToList();
}
......
......@@ -76,14 +76,12 @@ namespace Tests
public override DynamicMetaObject BindGetMember(GetMemberBinder binder)
{
var name = binder.Name;
var prop = this.properties.SingleOrDefault(o => o.Name == name);
var prop = this.properties.SingleOrDefault(o => o.Name == name);
if(prop != null) {
return new DynamicMetaObject(
Expression.Constant(prop.GetValue(this.value)), BindingRestrictions.GetTypeRestriction(Expression, LimitType));
Expression.Constant(prop.GetValue(this.value)), BindingRestrictions.GetTypeRestriction(Expression, LimitType));
}
......@@ -110,15 +108,10 @@ namespace Tests
return new DynamicMetaObject(
Expression.Block( Expression.Empty(), obj), BindingRestrictions.GetTypeRestriction(Expression, LimitType));
}
var mi = this.type.GetMethod("SetValue", BindingFlags.NonPublic | BindingFlags.Instance);
var args = new Expression[] {
Expression.Constant(name),
obj
......
.:53 {
# Your router
proxy . 192.168.1.1:53
file /etc/coredns/dns.nerdymishka.db nerdymishka.dev
errors
log
}
\ No newline at end of file
nerdymishka.dev. IN SOA dns.nerdymishka.dev. domains.nerdymishka.dev. (
2012062701 ; serial
300 ; refresh
1800 ; retry
14400 ; expire
300 ) ; minimum
@ IN NS dns.example.com.
@ 42000 IN A 127.0.0.1
@ 42000 IN A 127.0.0.2
@ 42000 IN A 127.0.0.3
\ No newline at end of file
version: '3.3'
services:
coredns:
image: coredns/coredns
restart: always
volumes:
- ./coredns/etc/:/etc/coredns
environment:
- conf=/etc/coredns/Corefile
ports:
- 53:53
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment