2020-05-13 13:01:49 +00:00
# Generated by Django 3.0.3 on 2020-05-13 13:01
2020-02-19 18:53:43 +00:00
from django . conf import settings
import django . core . validators
from django . db import migrations , models
import django . db . models . deletion
2020-06-16 14:12:44 +00:00
import django_etebase . models
2020-02-19 18:53:43 +00:00
class Migration ( migrations . Migration ) :
initial = True
dependencies = [
migrations . swappable_dependency ( settings . AUTH_USER_MODEL ) ,
]
operations = [
migrations . CreateModel (
name = ' Collection ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
2020-05-13 13:01:49 +00:00
( ' uid ' , models . CharField ( db_index = True , max_length = 44 , validators = [ django . core . validators . RegexValidator ( message = ' Not a valid UID ' , regex = ' [a-zA-Z0-9] ' ) ] ) ) ,
2020-02-19 18:53:43 +00:00
( ' version ' , models . PositiveSmallIntegerField ( ) ) ,
( ' owner ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , to = settings . AUTH_USER_MODEL ) ) ,
] ,
options = {
' unique_together ' : { ( ' uid ' , ' owner ' ) } ,
} ,
) ,
migrations . CreateModel (
name = ' CollectionItem ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
2020-05-13 13:01:49 +00:00
( ' uid ' , models . CharField ( db_index = True , max_length = 44 , null = True , validators = [ django . core . validators . RegexValidator ( message = ' Not a valid UID ' , regex = ' [a-zA-Z0-9] ' ) ] ) ) ,
2020-02-19 18:53:43 +00:00
( ' version ' , models . PositiveSmallIntegerField ( ) ) ,
2020-05-13 13:01:49 +00:00
( ' encryptionKey ' , models . BinaryField ( editable = True , null = True ) ) ,
2020-06-16 14:12:44 +00:00
( ' collection ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' items ' , to = ' django_etebase.Collection ' ) ) ,
2020-02-19 18:53:43 +00:00
] ,
options = {
' unique_together ' : { ( ' uid ' , ' collection ' ) } ,
} ,
) ,
migrations . CreateModel (
2020-05-13 13:01:49 +00:00
name = ' CollectionItemChunk ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' uid ' , models . CharField ( db_index = True , max_length = 44 , validators = [ django . core . validators . RegexValidator ( message = ' Expected a 256bit base64url. ' , regex = ' ^[a-zA-Z0-9 \\ -_] {43} $ ' ) ] ) ) ,
2020-06-16 14:12:44 +00:00
( ' chunkFile ' , models . FileField ( max_length = 150 , unique = True , upload_to = django_etebase . models . chunk_directory_path ) ) ,
( ' item ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' chunks ' , to = ' django_etebase.CollectionItem ' ) ) ,
2020-05-13 13:01:49 +00:00
] ,
) ,
migrations . CreateModel (
name = ' CollectionItemRevision ' ,
2020-02-19 18:53:43 +00:00
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
2020-05-13 13:01:49 +00:00
( ' uid ' , models . CharField ( db_index = True , max_length = 44 , unique = True , validators = [ django . core . validators . RegexValidator ( message = ' Expected a 256bit base64url. ' , regex = ' ^[a-zA-Z0-9 \\ -_] {43} $ ' ) ] ) ) ,
( ' meta ' , models . BinaryField ( editable = True ) ) ,
( ' current ' , models . BooleanField ( db_index = True , default = True , null = True ) ) ,
( ' deleted ' , models . BooleanField ( default = False ) ) ,
2020-06-16 14:12:44 +00:00
( ' item ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' revisions ' , to = ' django_etebase.CollectionItem ' ) ) ,
2020-02-19 18:53:43 +00:00
] ,
options = {
' unique_together ' : { ( ' item ' , ' current ' ) } ,
} ,
) ,
migrations . CreateModel (
2020-05-13 13:01:49 +00:00
name = ' RevisionChunkRelation ' ,
2020-02-19 18:53:43 +00:00
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
2020-06-16 14:12:44 +00:00
( ' chunk ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' revisions_relation ' , to = ' django_etebase.CollectionItemChunk ' ) ) ,
( ' revision ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' chunks_relation ' , to = ' django_etebase.CollectionItemRevision ' ) ) ,
2020-05-13 13:01:49 +00:00
] ,
options = {
' ordering ' : ( ' id ' , ) ,
} ,
) ,
migrations . CreateModel (
name = ' CollectionMember ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' encryptionKey ' , models . BinaryField ( editable = True ) ) ,
( ' accessLevel ' , models . CharField ( choices = [ ( ' adm ' , ' Admin ' ) , ( ' rw ' , ' Read Write ' ) , ( ' ro ' , ' Read Only ' ) ] , default = ' ro ' , max_length = 3 ) ) ,
2020-06-16 14:12:44 +00:00
( ' collection ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' members ' , to = ' django_etebase.Collection ' ) ) ,
2020-05-13 13:01:49 +00:00
( ' user ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , to = settings . AUTH_USER_MODEL ) ) ,
2020-02-19 18:53:43 +00:00
] ,
options = {
2020-05-13 13:01:49 +00:00
' unique_together ' : { ( ' user ' , ' collection ' ) } ,
2020-02-19 18:53:43 +00:00
} ,
) ,
]