mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	retention: Use new ArchiveTransaction model.
We add a new model, ArchiveTransaction, to tie archived objects together in a coherent way, according to the batches in which they are archived. This enables making a better system for restoring from archive, and it seems just more sensible to tie the archived objects in this way, rather the somewhat vague setting of archive_timestamp to each object using timezone_now().
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							e8d49330f2
						
					
				
				
					commit
					a2cce62c1c
				
			
							
								
								
									
										52
									
								
								zerver/migrations/0231_add_archive_transaction_model.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								zerver/migrations/0231_add_archive_transaction_model.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.11.20 on 2019-06-23 21:20 | ||||
| from __future__ import unicode_literals | ||||
|  | ||||
| from django.db import migrations, models | ||||
| import django.db.models.deletion | ||||
| import django.utils.timezone | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ('zerver', '0230_rename_to_enable_stream_audible_notifications'), | ||||
|     ] | ||||
|  | ||||
|     operations = [ | ||||
|         migrations.CreateModel( | ||||
|             name='ArchiveTransaction', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||||
|                 ('timestamp', models.DateTimeField(db_index=True, default=django.utils.timezone.now)), | ||||
|                 ('restored', models.BooleanField(db_index=True, default=False)), | ||||
|                 ('type', models.PositiveSmallIntegerField(db_index=True)), | ||||
|                 ('realm', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='zerver.Realm')), | ||||
|             ], | ||||
|         ), | ||||
|         migrations.RemoveField( | ||||
|             model_name='archivedattachment', | ||||
|             name='archive_timestamp', | ||||
|         ), | ||||
|         migrations.RemoveField( | ||||
|             model_name='archivedmessage', | ||||
|             name='archive_timestamp', | ||||
|         ), | ||||
|         migrations.RemoveField( | ||||
|             model_name='archivedreaction', | ||||
|             name='archive_timestamp', | ||||
|         ), | ||||
|         migrations.RemoveField( | ||||
|             model_name='archivedsubmessage', | ||||
|             name='archive_timestamp', | ||||
|         ), | ||||
|         migrations.RemoveField( | ||||
|             model_name='archivedusermessage', | ||||
|             name='archive_timestamp', | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='archivedmessage', | ||||
|             name='archive_transaction', | ||||
|             field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='zerver.ArchiveTransaction'), | ||||
|         ), | ||||
|     ] | ||||
		Reference in New Issue
	
	Block a user