|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +from __future__ import unicode_literals |
| 3 | + |
| 4 | +from django.db import models, migrations |
| 5 | +import jsonfield.fields |
| 6 | +import api.models |
| 7 | +import api.fields |
| 8 | +from django.conf import settings |
| 9 | + |
| 10 | + |
| 11 | +class Migration(migrations.Migration): |
| 12 | + |
| 13 | + dependencies = [ |
| 14 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 15 | + ] |
| 16 | + |
| 17 | + operations = [ |
| 18 | + migrations.CreateModel( |
| 19 | + name='App', |
| 20 | + fields=[ |
| 21 | + ('uuid', api.fields.UuidField(auto_created=True, primary_key=True, serialize=False, editable=False, max_length=32, unique=True, verbose_name='UUID')), |
| 22 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 23 | + ('updated', models.DateTimeField(auto_now=True)), |
| 24 | + ('id', models.SlugField(max_length=24, unique=True, null=True, validators=[api.models.validate_id_is_docker_compatible, api.models.validate_reserved_names])), |
| 25 | + ('structure', jsonfield.fields.JSONField(default={}, blank=True, validators=[api.models.validate_app_structure])), |
| 26 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 27 | + ], |
| 28 | + options={ |
| 29 | + 'permissions': (('use_app', 'Can use app'),), |
| 30 | + }, |
| 31 | + bases=(models.Model,), |
| 32 | + ), |
| 33 | + migrations.CreateModel( |
| 34 | + name='Build', |
| 35 | + fields=[ |
| 36 | + ('uuid', api.fields.UuidField(auto_created=True, primary_key=True, serialize=False, editable=False, max_length=32, unique=True, verbose_name='UUID')), |
| 37 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 38 | + ('updated', models.DateTimeField(auto_now=True)), |
| 39 | + ('image', models.CharField(max_length=256)), |
| 40 | + ('sha', models.CharField(max_length=40, blank=True)), |
| 41 | + ('procfile', jsonfield.fields.JSONField(default={}, blank=True)), |
| 42 | + ('dockerfile', models.TextField(blank=True)), |
| 43 | + ('app', models.ForeignKey(to='api.App')), |
| 44 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 45 | + ], |
| 46 | + options={ |
| 47 | + 'ordering': ['-created'], |
| 48 | + 'get_latest_by': 'created', |
| 49 | + }, |
| 50 | + bases=(models.Model,), |
| 51 | + ), |
| 52 | + migrations.CreateModel( |
| 53 | + name='Certificate', |
| 54 | + fields=[ |
| 55 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 56 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 57 | + ('updated', models.DateTimeField(auto_now=True)), |
| 58 | + ('certificate', models.TextField(validators=[api.models.validate_certificate])), |
| 59 | + ('key', models.TextField()), |
| 60 | + ('common_name', models.TextField(unique=True)), |
| 61 | + ('expires', models.DateTimeField()), |
| 62 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 63 | + ], |
| 64 | + options={ |
| 65 | + 'abstract': False, |
| 66 | + }, |
| 67 | + bases=(models.Model,), |
| 68 | + ), |
| 69 | + migrations.CreateModel( |
| 70 | + name='Config', |
| 71 | + fields=[ |
| 72 | + ('uuid', api.fields.UuidField(auto_created=True, primary_key=True, serialize=False, editable=False, max_length=32, unique=True, verbose_name='UUID')), |
| 73 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 74 | + ('updated', models.DateTimeField(auto_now=True)), |
| 75 | + ('values', jsonfield.fields.JSONField(default={}, blank=True)), |
| 76 | + ('memory', jsonfield.fields.JSONField(default={}, blank=True)), |
| 77 | + ('cpu', jsonfield.fields.JSONField(default={}, blank=True)), |
| 78 | + ('tags', jsonfield.fields.JSONField(default={}, blank=True)), |
| 79 | + ('app', models.ForeignKey(to='api.App')), |
| 80 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 81 | + ], |
| 82 | + options={ |
| 83 | + 'ordering': ['-created'], |
| 84 | + 'get_latest_by': 'created', |
| 85 | + }, |
| 86 | + bases=(models.Model,), |
| 87 | + ), |
| 88 | + migrations.CreateModel( |
| 89 | + name='Container', |
| 90 | + fields=[ |
| 91 | + ('uuid', api.fields.UuidField(auto_created=True, primary_key=True, serialize=False, editable=False, max_length=32, unique=True, verbose_name='UUID')), |
| 92 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 93 | + ('updated', models.DateTimeField(auto_now=True)), |
| 94 | + ('type', models.CharField(max_length=128)), |
| 95 | + ('num', models.PositiveIntegerField()), |
| 96 | + ('app', models.ForeignKey(to='api.App')), |
| 97 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 98 | + ], |
| 99 | + options={ |
| 100 | + 'ordering': ['created'], |
| 101 | + 'get_latest_by': '-created', |
| 102 | + }, |
| 103 | + bases=(models.Model,), |
| 104 | + ), |
| 105 | + migrations.CreateModel( |
| 106 | + name='Domain', |
| 107 | + fields=[ |
| 108 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 109 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 110 | + ('updated', models.DateTimeField(auto_now=True)), |
| 111 | + ('domain', models.TextField(unique=True)), |
| 112 | + ('app', models.ForeignKey(to='api.App')), |
| 113 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 114 | + ], |
| 115 | + options={ |
| 116 | + 'abstract': False, |
| 117 | + }, |
| 118 | + bases=(models.Model,), |
| 119 | + ), |
| 120 | + migrations.CreateModel( |
| 121 | + name='Key', |
| 122 | + fields=[ |
| 123 | + ('uuid', api.fields.UuidField(auto_created=True, primary_key=True, serialize=False, editable=False, max_length=32, unique=True, verbose_name='UUID')), |
| 124 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 125 | + ('updated', models.DateTimeField(auto_now=True)), |
| 126 | + ('id', models.CharField(max_length=128)), |
| 127 | + ('public', models.TextField(unique=True, validators=[api.models.validate_base64])), |
| 128 | + ('fingerprint', models.CharField(max_length=128)), |
| 129 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 130 | + ], |
| 131 | + options={ |
| 132 | + 'verbose_name': 'SSH Key', |
| 133 | + }, |
| 134 | + bases=(models.Model,), |
| 135 | + ), |
| 136 | + migrations.CreateModel( |
| 137 | + name='Push', |
| 138 | + fields=[ |
| 139 | + ('uuid', api.fields.UuidField(auto_created=True, primary_key=True, serialize=False, editable=False, max_length=32, unique=True, verbose_name='UUID')), |
| 140 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 141 | + ('updated', models.DateTimeField(auto_now=True)), |
| 142 | + ('sha', models.CharField(max_length=40)), |
| 143 | + ('fingerprint', models.CharField(max_length=255)), |
| 144 | + ('receive_user', models.CharField(max_length=255)), |
| 145 | + ('receive_repo', models.CharField(max_length=255)), |
| 146 | + ('ssh_connection', models.CharField(max_length=255)), |
| 147 | + ('ssh_original_command', models.CharField(max_length=255)), |
| 148 | + ('app', models.ForeignKey(to='api.App')), |
| 149 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 150 | + ], |
| 151 | + options={ |
| 152 | + 'ordering': ['-created'], |
| 153 | + 'get_latest_by': 'created', |
| 154 | + }, |
| 155 | + bases=(models.Model,), |
| 156 | + ), |
| 157 | + migrations.CreateModel( |
| 158 | + name='Release', |
| 159 | + fields=[ |
| 160 | + ('uuid', api.fields.UuidField(auto_created=True, primary_key=True, serialize=False, editable=False, max_length=32, unique=True, verbose_name='UUID')), |
| 161 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 162 | + ('updated', models.DateTimeField(auto_now=True)), |
| 163 | + ('version', models.PositiveIntegerField()), |
| 164 | + ('summary', models.TextField(null=True, blank=True)), |
| 165 | + ('app', models.ForeignKey(to='api.App')), |
| 166 | + ('build', models.ForeignKey(to='api.Build', null=True)), |
| 167 | + ('config', models.ForeignKey(to='api.Config')), |
| 168 | + ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL)), |
| 169 | + ], |
| 170 | + options={ |
| 171 | + 'ordering': ['-created'], |
| 172 | + 'get_latest_by': 'created', |
| 173 | + }, |
| 174 | + bases=(models.Model,), |
| 175 | + ), |
| 176 | + migrations.AlterUniqueTogether( |
| 177 | + name='release', |
| 178 | + unique_together=set([('app', 'version')]), |
| 179 | + ), |
| 180 | + migrations.AlterUniqueTogether( |
| 181 | + name='push', |
| 182 | + unique_together=set([('app', 'uuid')]), |
| 183 | + ), |
| 184 | + migrations.AlterUniqueTogether( |
| 185 | + name='key', |
| 186 | + unique_together=set([('owner', 'fingerprint')]), |
| 187 | + ), |
| 188 | + migrations.AddField( |
| 189 | + model_name='container', |
| 190 | + name='release', |
| 191 | + field=models.ForeignKey(to='api.Release'), |
| 192 | + preserve_default=True, |
| 193 | + ), |
| 194 | + migrations.AlterUniqueTogether( |
| 195 | + name='config', |
| 196 | + unique_together=set([('app', 'uuid')]), |
| 197 | + ), |
| 198 | + migrations.AlterUniqueTogether( |
| 199 | + name='build', |
| 200 | + unique_together=set([('app', 'uuid')]), |
| 201 | + ), |
| 202 | + ] |
0 commit comments