text: # Generated by Django 3.1.1 on 2020-09-04 07:14
  
  from django.conf import settings
  from django.db import migrations, models
  import django.db.models.deletion
  
  
  class Migration(migrations.Migration):
  
      initial = True
  
      dependencies = [
          migrations.swappable_dependency(settings.AUTH_USER_MODEL),
      ]
  
      operations = [
          migrations.CreateModel(
              name='Organization',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Created on')),
                  ('write_date', models.DateTimeField(auto_now=True, verbose_name='Last Modified on')),
                  ('name', models.CharField(max_length=255, unique=True, verbose_name='Name')),
                  ('level', models.IntegerField(choices=[(0, 'Normal'), (1, 'Company'), (2, 'Department'), (3, 'Division')], default=0, verbose_name='Level')),
                  ('create_user', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='create_base_organization_set', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
                  ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='childs', to='base.organization', verbose_name='Parent Organization')),
              ],
              options={
                  'verbose_name': 'Organization',
              },
          ),
          migrations.CreateModel(
              name='OrganizationMemberRole',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Created on')),
                  ('write_date', models.DateTimeField(auto_now=True, verbose_name='Last Modified on')),
                  ('name', models.CharField(max_length=255, unique=True, verbose_name='Name')),
                  ('create_user', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='create_base_organizationmemberrole_set', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
                  ('write_user', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='write_base_organizationmemberrole_set', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified by')),
              ],
              options={
                  'verbose_name': 'Organization Role',
              },
          ),
          migrations.CreateModel(
              name='OrganizationMember',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Created on')),
                  ('write_date', models.DateTimeField(auto_now=True, verbose_name='Last Modified on')),
                  ('create_user', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='create_base_organizationmember_set', to=settings.AUTH_USER_MODEL, verbose_name='Created by')),
                  ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='base.organization')),
                  ('roles', models.ManyToManyField(blank=True, to='base.OrganizationMemberRole', verbose_name='roles')),
                  ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                  ('write_user', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='write_base_organizationmember_set', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified by')),
              ],
              options={
                  'verbose_name': 'Organization Member',
                  'ordering': ('organization', 'user'),
                  'unique_together': {('organization', 'user')},
              },
          ),
          migrations.AddField(
              model_name='organization',
              name='users',
              field=models.ManyToManyField(blank=True, related_name='orgs', through='base.OrganizationMember', to=settings.AUTH_USER_MODEL, verbose_name='Organization Users'),
          ),
          migrations.AddField(
              model_name='organization',
              name='write_user',
              field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='write_base_organization_set', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified by'),
          ),
      ]
  