parent
							
								
									fde06a2e27
								
							
						
					
					
						commit
						dfb0ff3b9c
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -261,3 +261,4 @@ src/MyWebLog/wwwroot/img/daniel-j-summers
 | 
				
			|||||||
src/MyWebLog/wwwroot/img/bit-badger
 | 
					src/MyWebLog/wwwroot/img/bit-badger
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.ionide
 | 
					.ionide
 | 
				
			||||||
 | 
					src/MyWebLog/appsettings.Production.json
 | 
				
			||||||
 | 
				
			|||||||
@ -42,9 +42,6 @@ module private RethinkHelpers =
 | 
				
			|||||||
        /// A list of all tables
 | 
					        /// A list of all tables
 | 
				
			||||||
        let all = [ Category; Comment; Page; Post; TagMap; Theme; ThemeAsset; WebLog; WebLogUser ]
 | 
					        let all = [ Category; Comment; Page; Post; TagMap; Theme; ThemeAsset; WebLog; WebLogUser ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// A list of all tables with a webLogId field
 | 
					 | 
				
			||||||
        let allForWebLog = [ Comment; Post; Category; TagMap; Page; WebLogUser ]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Shorthand for the ReQL starting point
 | 
					    /// Shorthand for the ReQL starting point
 | 
				
			||||||
    let r = RethinkDB.R
 | 
					    let r = RethinkDB.R
 | 
				
			||||||
@ -743,7 +740,30 @@ type RethinkDbData (conn : Net.IConnection, config : DataConfig, log : ILogger<R
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                member _.delete webLogId = backgroundTask {
 | 
					                member _.delete webLogId = backgroundTask {
 | 
				
			||||||
                    for table in Table.allForWebLog do
 | 
					                     // Comments should be deleted by post IDs
 | 
				
			||||||
 | 
					                     let! thePostIds = rethink<{| id : string |} list> {
 | 
				
			||||||
 | 
					                         withTable Table.Post
 | 
				
			||||||
 | 
					                         getAll [ webLogId ] (nameof webLogId)
 | 
				
			||||||
 | 
					                         pluck [ "id" ]
 | 
				
			||||||
 | 
					                         result; withRetryOnce conn
 | 
				
			||||||
 | 
					                     }
 | 
				
			||||||
 | 
					                     if not (List.isEmpty thePostIds) then
 | 
				
			||||||
 | 
					                         let postIds = thePostIds |> List.map (fun it -> it.id :> obj)
 | 
				
			||||||
 | 
					                         do! rethink {
 | 
				
			||||||
 | 
					                             withTable Table.Comment
 | 
				
			||||||
 | 
					                             getAll postIds "postId"
 | 
				
			||||||
 | 
					                             delete
 | 
				
			||||||
 | 
					                             write; withRetryOnce; ignoreResult conn
 | 
				
			||||||
 | 
					                         }
 | 
				
			||||||
 | 
					                     // Tag mappings do not have a straightforward webLogId index
 | 
				
			||||||
 | 
					                     do! rethink {
 | 
				
			||||||
 | 
					                         withTable Table.TagMap
 | 
				
			||||||
 | 
					                         between (r.Array (webLogId, r.Minval ())) (r.Array (webLogId, r.Maxval ()))
 | 
				
			||||||
 | 
					                                     [ Index "webLogAndTag" ]
 | 
				
			||||||
 | 
					                         delete
 | 
				
			||||||
 | 
					                         write; withRetryOnce; ignoreResult conn
 | 
				
			||||||
 | 
					                     }
 | 
				
			||||||
 | 
					                     for table in [ Table.Post; Table.Category; Table.Page; Table.WebLogUser ] do
 | 
				
			||||||
                         do! rethink {
 | 
					                         do! rethink {
 | 
				
			||||||
                             withTable table
 | 
					                             withTable table
 | 
				
			||||||
                             getAll [ webLogId ] (nameof webLogId)
 | 
					                             getAll [ webLogId ] (nameof webLogId)
 | 
				
			||||||
 | 
				
			|||||||
@ -275,7 +275,7 @@ module Backup =
 | 
				
			|||||||
            match! data.WebLog.findById archive.webLog.id with
 | 
					            match! data.WebLog.findById archive.webLog.id with
 | 
				
			||||||
            | Some webLog when defaultArg newUrlBase webLog.urlBase = webLog.urlBase ->
 | 
					            | Some webLog when defaultArg newUrlBase webLog.urlBase = webLog.urlBase ->
 | 
				
			||||||
                do! data.WebLog.delete webLog.id
 | 
					                do! data.WebLog.delete webLog.id
 | 
				
			||||||
                return archive
 | 
					                return { archive with webLog = { archive.webLog with urlBase = defaultArg newUrlBase webLog.urlBase } }
 | 
				
			||||||
            | Some _ ->
 | 
					            | Some _ ->
 | 
				
			||||||
                // Err'body gets new IDs...
 | 
					                // Err'body gets new IDs...
 | 
				
			||||||
                let newWebLogId = WebLogId.create ()
 | 
					                let newWebLogId = WebLogId.create ()
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@
 | 
				
			|||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <Content Include="appsettings.json" CopyToOutputDirectory="Always" />
 | 
					    <Content Include="appsettings*.json" CopyToOutputDirectory="Always" />
 | 
				
			||||||
    <Compile Include="Caches.fs" />
 | 
					    <Compile Include="Caches.fs" />
 | 
				
			||||||
    <Compile Include="Handlers\Error.fs" />
 | 
					    <Compile Include="Handlers\Error.fs" />
 | 
				
			||||||
    <Compile Include="Handlers\Helpers.fs" />
 | 
					    <Compile Include="Handlers\Helpers.fs" />
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user