mirror of
				https://github.com/yanislav-igonin/micrach
				synced 2025-11-04 02:27:02 +03:00 
			
		
		
		
	feat: archive only parents
This commit is contained in:
		
							parent
							
								
									8c448d11a1
								
							
						
					
					
						commit
						21f804cafb
					
				@ -2,6 +2,7 @@
 | 
				
			|||||||
Go tryout. Single board imageboard.
 | 
					Go tryout. Single board imageboard.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Prerequisites
 | 
					## Prerequisites
 | 
				
			||||||
Create db.  
 | 
					1. Go 1.13+.
 | 
				
			||||||
Run migrations from `migrations`.  
 | 
					2. PostgreSQL.
 | 
				
			||||||
Create `.env` file from `.env.example`, change env vars to your needs.
 | 
					3. Create `.env` file from `.env.example`, change env vars to your needs.
 | 
				
			||||||
 | 
					4. Create db with the name that is specified in `.env` file in `POSTGRES_URL` env var.
 | 
				
			||||||
 | 
				
			|||||||
@ -237,7 +237,8 @@ func (r *PostsRepository) ArchiveThreadsFrom(t time.Time) error {
 | 
				
			|||||||
		UPDATE posts
 | 
							UPDATE posts
 | 
				
			||||||
		SET is_archived = true
 | 
							SET is_archived = true
 | 
				
			||||||
		WHERE 
 | 
							WHERE 
 | 
				
			||||||
			is_archived != true
 | 
								is_parent = true
 | 
				
			||||||
 | 
								AND is_archived != true
 | 
				
			||||||
			AND updated_at <= $1
 | 
								AND updated_at <= $1
 | 
				
			||||||
	`
 | 
						`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user